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.
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
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.
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?
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.The exec function
The exec function can be used when you want a function to run immediately in the configuration (as opposed to the beforedraw and draw events which occur when you call the draw function.
<script>
bar = new RGraph.Bar({
id: 'cvs',
data: [2,2,2,1,2,3,2,3,4],
options: {
yaxisLabels: false,
colors: ['red','pink','blue','yellow','#0f0','gray','red','green','black'],
colorsSequential: true,
marginLeft: 50
}
}).draw().exec(function (obj)
{
alert('In the exec() function');
});
</script>
It can run either before the draw
function or after based on whether you put the function before or after
the draw call. Here's an example of it being used before the draw function call
(so it's similar to the beforedraw event - but only runs once:
<script>
bar = new RGraph.Bar({
id: 'cvs',
data: [2,2,2,1,2,3,2,3,4],
options: {
yaxisLabels: false,
colors: ['red','pink','blue','yellow','#0f0','gray','red','green','black'],
colorsSequential: true,
marginLeft: 50
}
// The exec function is before the draw call so in effect it would be very
// similar to a beforefirstdraw event - but that event doesn't exist.
}).exec(function ()
{
alert('The chart has not been drawn yet.');
}).draw();
</script>
And here is an example of using the exec function after the draw function call. Remember that the exec function is only run once - so it's very much like the firstdraw event that you can use. In fact the difference may be just syntax.
<script>
bar = new RGraph.Bar({
id: 'cvs',
data: [2,2,2,1,2,3,2,3,4],
options: {
yaxisLabels: false,
colors: ['red','pink','blue','yellow','#0f0','gray','red','green','black'],
colorsSequential: true,
marginLeft: 50
}
}).draw()
// The exec function is after the draw call so in effect it more or less
// is the same as the firstdraw event.
.exec(function ()
{
alert('The chart has been drawn at this point');
});
</script>