About
RGraph is a JavaScript charts library based on
HTML5 SVG and canvas. RGraph is mature (over 17 years
old) and has a wealth of features making it an ideal
choice to use for showing charts on your website.
Version 7.01 released
Version 7.01 (released in October 2025) is the
latest version of RGraph and now includes a new tree
structure object. The accompanying Treemenu object can then turn
the object into a fully dynamic tree menu.
You can read the API documentation for the tree on
the main API documentation page
and see an example of the Treemenu
feature by following this link...
New HTML datagrid
In the April 2025 (v6.21) release a new datagrid object
was added.
This makes it easy to add static or dynamic data
tables to your pages. It can be used whether you use the
canvas or SVG libraries or entirely standalone.
Download
Get the latest version of RGraph (version 7.01, 8th October 2025) 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.
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.A Bar chart using AJAX
Here is an example of a 3D variation of the Bar chart which is both animated using the grow effect and which is also fetching its data via ajax.
The ajax script is a simple one that just outputs a sequence of random numbers. You can see the script directly by going here.
If you view the ajax script you'll see that it just outputs the numbers and nothing else - so no labels or title. So on the chart, the labels are just hardcoded.
The rest of the configuration is pretty straightforward - and you can see it below.
When the screen is smaller the canvas dimensions are reduced, the marginInner is reduced and the textSize is reduced as well.
This goes in the documents header:<script src="RGraph.common.core.js"></script> <script src="RGraph.common.dynamic.js"></script> <script src="RGraph.common.tooltips.js"></script> <script src="RGraph.bar.js"></script>Put this where you want the chart to show up:
<div style="float: right"> <canvas id="cvs" width="600" 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 RGraph.AJAX.getCSV() function to fetch some CSV data from the server. // This example fetches the URL https://www.rgraph.net/getdata.html which just // outputs a set of CSV values. The second argument is a function which is // used as the callback and creates the chart. RGraph.AJAX.getCSV('/getdata.html', function (data) { new RGraph.Bar({ id: 'cvs', // Use the CSV data directly in the chart configuration data: data, options: { colors: ['gradient(#080:green)'], xaxisLabels: ['John', 'Fred', 'Joe', 'Rich', 'Pete', 'Lilly', 'Fred', 'Joe', 'Rich', 'Pete'], marginLeft: 35, // This sets it so that the bar chart is drawn as a 3D variant variant: '3d', // 3D Bar charts look better with a transparent stroke color colorsStroke: 'transparent', marginInnerGrouped: true, backgroundGridVlines: false, backgroundGridBorder: false, shadowOffsetx: 10, marginBottom: 75, xaxis: false, yaxis: false, tooltips: '<span style="font-size: 14pt">Total value:<br /><span style="font-size: 26pt">%{value}%', title: 'An animated 3D Bar chart', titleColor: '#666', titleBold: true, titleSize: 16, titleOffsety: 5, titleSubtitle: 'This chart uses random data', titleSubtitleOffsety: -5, responsive: [ {maxWidth: null,width:600,height:250,options:{marginInner: 10,textSize:12},parentCss:{'float': 'right',textAlign:'none'}}, {maxWidth: 800,width:400,height:200,options:{marginInner: 5,textSize:10},parentCss:{'float': 'none',textAlign:'center'}} ] } // The grow() animation effect is used and works just like a regular Bar chart. Some // responsive capability is also added. }).grow(); }); </script>