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 »

 

SQLite Editor for PHP
The SQLite Editor for PHP software is a tool which will help you and/or your users administer and maintain your SQLite databases. Built as a tool that you can easily provide to your users, there's no danger of them damaging your database.

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.


23rd June, Richard
The SQLite Editor for PHP admin tool is now available for you to download

16th June, Rachel
I have a question about the 3D Bar chart

12th June, Marco
Should I use SVG or canvas for the charts on my website?

9th June, Richard
New version of RGraph: version 7.20

3rd June, Patrick
Question about installing RGraph

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 »

The CSV connector

Written by Richard Heyes, RGraph author, on 26th July 2018
This is the final spotlight article and it focuses on the AJAX-based CSV connector that is bundled with RGraph. There's also an AJAX function - getCSV() - but this dedicated CSV reader is more comprehensive and more versatile.

Introduction

The csv reader is an established (since October 2013) way of easily getting data into RGraph from csv files.

It can be configured to a higher degree compared to the simple ajax function getCSV. This includes the ability to read from a dom element as well as a csv file and it can easily handle different types of csv files with its getRow and getCol methods.

By using the csv reader you can easily integrate with a database by having your database server-side script output the data in a csv format and then use this csv reader to fetch that file.

You may find it easier to have the script that gets the data from the database produce the page and chart, but by making an extra file whose sole job is to fetch the data and print it you could use this script on other pages or offer it as a public web service.

There's both a canvas and an svg version of the csv reader and those files are:

Example code

This is some example code that creates a chart - using the labelsAbove option instead of the regular labels.

<script>
    // Call the CSV import code and have it download the sample.csv file.
    // The csv argument to the callback function contains the contents of the
    // CSV file.
    new RGraph.CSV('/sample.csv', function (csv)
    {
        // Get the first column which becomes the labels
        var labels  = csv.getCol(0);
        
        // Get the second column which becomes the data
        var data = csv.getCol(1);
        
        // Get the number of rows in the CSV
        var numrows = csv.numrows;
        
        // Get the number of cols in the CSV
        var numcols = csv.numcols;
        

        
        new RGraph.SVG.Bar({
            id:'cc',
            data: data,
            options: {
                title: 'A chart using the CSV reader',
                titleSize: 18,
                colors: ['black'],
                marginTop: 35,
                textSize: 14,
                labelsAbove: true,
                labelsAboveSpecific: labels,
                labelsAboveOffsety: 30,
                labelsAboveSize: 14,
                labelsAboveColor: 'white'
            }
        }).wave();
    });
</script>

Further reading

If you want to know more about the csv reader or perhaps you want to use it in your project(s) then a link to the csv reader documentation page is below. Note that despite being in the canvas section of the documentation this also applies to the svg csv reader.