Using the CSV reader

View the bare-bones version of this demo with any interactive features or animations enabled

Note: For browser security reasons the AJAX demos don't work offline. You can view the demos on the RGraph website here: https://www.rgraph.net/demos/index.html

Here we have a very simple example of the CSV Reader that is bundled with RGraph. This is in addition to the RGraph.AJAX.getCSV function.

The code that fetches the data is this:

var data = csv.getRow(0, 1);

This code fetches the first row (the zero-indexed first argument) and the second argument stipulates that the first element of that row should be ignored (ie starting from column 1 instead of column 0.

The only other configuration for the chart is the stipulation of the labels and an increase in the size of the left margin.


This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.csv.js"></script>
<script src="RGraph.hbar.js"></script>
Put this where you want the chart to show up:
<div  style="float: right">
    <canvas id="cvs" width="500" height="250">[No canvas support]</canvas>
</div>
This is the code that generates the chart - it should be placed AFTER the canvas tag(s):