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.


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
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 »

AJAX functions

RGraph has some simplified ajax helper functions that make it much easier to initiate ajax calls without having to be concerned about what the format that the response is in (string, number, object etc).

Previously, because the response to an ajax request is a string, you had to convert it into a usable form (such as a number or an array).

With these functions though they automatically do the data format conversion for you. The AJAX functions that are available to you are:

Name: string RGraph.AJAX(string url, function callback)
Description: 
Fetches the URL and returns the response to you as a string. No processing is performed on the response.
Name: number RGraph.AJAX.getNumber(string url, function callback)
Description: 
Fetches the URL and returns the response to you as a number. This assumes that the output of the AJAX request is a single number.
Name: string RGraph.AJAX.getString(string url, function callback)
Description: 
Fetches the URL and returns the response to you as a string.
Name: array RGraph.AJAX.getCSV(string url, function callback[, string separator = ","])
Description: 
Fetches the URL and returns the response to you as an array. The response is split on the optional separator, which defaults to a comma. It doesn't support multi-line files - it only fetches a single line of CSV data. If you want multi-line support, you'll need to use the CSV import utility.
Name: object RGraph.AJAX.getJSON(string url, function callback)
Description: 
Fetches the URL and returns the response to you as an object. This is the most versatile of all of the AJAX methods, allowing you to retrieve multiple pieces of data in one call. It uses the JavaScript eval() function to convert the reponse to an object.
Name: string RGraph.AJAX.post(string url, object data, function callback)
Description: 
This function allows you to make HTTP POST requests and send data back to the server. The data argument should be a JavaScript object of key/value pairs that will be sent to the server. The data is encoded for you.

There are straight-forward examples of the AJAX functions in the basic examples in the download archive

<script>
    RGraph.AJAX.getJSON('/getdata.html?json', function (json)
    {
        new RGraph.Bar({
            id: 'cvs',
            data: json.data,
            options: {
                marginLeft:     50,
                marginInner:    10,
                tickmarksStyle: 'endcircle',
                linewidth:      2,
                xaxisLabels:    json.labels
            }
        }).draw();
    });
</script>

* As of October 2013 there's now a dedicated CSV reader (that also fetches a CSV file via AJAX) that's a part of RGraph.