A Line chart using the CSV reader
Summary: A simple Line chart that's using the CSV reader to get the data that's shown on the chart.
A Line chart that's serving as a basic example of using the CSV Reader in conjunction with the CSV reader.
The data that's being fetched is done with this line-of-code:
var data = csv.getCol(2);
And what that does is fetch the whole of the third column (counting starts at zero). This column of data is then given to the chart as its data. The X axis labels for the chart are simply hard coded but they could quite easily be fetched from the first column of the CSV like this:
var labels = csv.getCol(0);
responsive() function reduces the size of the canvas tag, reduces the size of the text
and rotates the X labels to an angle of 45 degrees. It also adds a bottom CSS
and removes the CSS
This goes in the documents header:
<script src="RGraph.common.core.js"></script> <script src="RGraph.common.csv.js"></script> <script src="RGraph.line.js"></script>Put this where you want the chart to show up: