An SVG Bar chart using the CSV reader
This goes in the documents header:
<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.common.tooltips.js"></script>
<script src="RGraph.svg.common.ajax.js"></script>
<script src="RGraph.svg.common.csv.js"></script>
<script src="RGraph.svg.bar.js"></script>
Put this where you want the chart to show up:
<div style="width: 500px; height: 250px" id="chart-container"></div>
This is the code that generates the chart:
<script>
new RGraph.CSV('/sample.csv', function (csv)
{
var data = csv.getRow(0).slice(1,7),
labels = csv.getCol(0);
var bar = new RGraph.SVG.Bar({
id: 'chart-container',
data: data,
options: {
xaxis: false,
yaxis: false,
xaxisLabels: labels,
backgroundGridVlines: false,
backgroundGridBorder: false,
colorsSequential: true,
tooltips: labels
}
}).wave();
});
</script>