MENU
.net Powerful JavaScript charts
About
RGraph is a JavaScript charts library based on HTML5 SVG and canvas. RGraph is mature (over 18 years old) and has a wealth of features making it an ideal choice to use for showing charts on your website.

More »

 

Version 7.20
Version 7.20 (released in June 2026) is the latest version of RGraph and the major change in this version is an update to the default values of properties making for better looking charts without having to set any properties. Read more about this and other changes in the changelog.

Download »

 

Download
Get the latest version of RGraph (version 7.20, 9th June 2026) from the download page. You can read the changelog here. There's also older versions available, minified files and links to cdnjs.com hosted libraries.

Download »

 

Latest forum posts
These are the latest support forum posts that have been posted or updated.

9th June, Richard
New version of RGraph: version 7.20
3rd June, Patrick
Question about installing RGraph
1st June, Ouja
How do I add a click event to a bar in my Bar chart?
8th May, Anthony Kuma
Does the SVG Line chart have outofbounds functionality?


Support forum »

 

License
RGraph can be used for free under the GPL or if that doesn't suit your situation there's an inexpensive (£129) commercial license available.

More »

Using the CSV reader

[No canvas support]

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):
<script>
    // Use the CSV connector to read the sample.csv file from the server
    new RGraph.CSV({url: '/sample.csv', callback: function (csv)
    {
        // Fetch the first row of the CSV file, starting at the second column
        // (as with many things in programming - counting starts at zero)
        var data = csv.row(0, 1);

        // Create and show the Horizontal Bar chart using the data that was
        // retrieved from the CSV file. The only other configuration is the
        // addition of some labels and widening the left margin.
        new RGraph.HBar({
            id: 'cvs',
            data: data,
            options: {
                textSize: 16,
                yaxisLabels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
                marginLeft: 95,
                marginInner: 5,
                responsive: [
                    {maxWidth: null,parentCss:{'float':'right',textAlign:'none'}},
                    {maxWidth: 750,parentCss:{'float':'none',textAlign:'center'}}
                ]
            }
        }).draw();
    }});
</script>