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.A basic Pie chart
A simple Pie chart that shows off the label sticks to good effect. As far as the Pie chart itself goes there's not a whole lot to it - the tooltips and labels both use the same array (which is defined just above the chart itself).
The shadow is turned off (set to a transparent color) and the stroke color is also set to transparent. The Pie chart also uses the roundRobin animation effect.
With smaller screens the labels are disabled and a key is used instead. This takes up a little extra space so that the chart fits better in the available space.
The tooltips have been customised using formatted tooltips and the tooltipsCss property.
This goes in the documents header:
<script src="RGraph.common.core.js"></script> <script src="RGraph.common.key.js"></script> <script src="RGraph.common.dynamic.js"></script> <script src="RGraph.common.tooltips.js"></script> <script src="RGraph.pie.js"></script>Put this where you want the chart to show up:
<div>
<canvas id="cvs" width="350" 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>
// A basic configuration for a Pie chart with just the labels
// separated out into their own array. This is because the same
// array is used for both the labels and the tooltips so
// doing this makes for less upkeep when the time comes to
// change things around.
//
// Also note that the stroke color has been set to transparent so
// that there's no separation between the segments
//
labels = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
new RGraph.Pie({
id: 'cvs',
data: [20,1,1,1,1,1,1],
options: {
// This is the tooltip property using formatted tooltips
tooltips: '%{property:myDaynames[%{index}]}<br /><span style="font-weight: bold; font-size:26pt">%{value_formatted}',
// The units that are appended to the %{value_formatted} value
tooltipsFormattedUnitsPost: '%',
// Turn the little triangular pointer off
tooltipsPointer: false,
// Turn fixed positioning off
tooltipsPositionStatic: false,
// Some CSS values that are set on the tooltips so that you can customise them
tooltipsCss: {
backgroundColor: 'white',
color: 'black',
border: '3px solid black'
},
// A custom property - the formatted tooltips can then
// access this to use the data inside the tooltip
myDaynames: labels,
keyPositionGraphBoxed: false,
responsive: [
{maxWidth: null,width:550,height:250,options: {centerx: null,key: [],labels: labels},parentCss:{'float':'right',textAlign:'none'}},
{maxWidth: 750,width:420,height:250,options: {centerx: 150,key:labels, labels: []},parentCss:{'float':'none',textAlign:'center'}}
]
}
// Draw the chart and add responsive capabilities. On smaller screens the width
// is reduced and the labels are changed to a key. This takes up less space.
}).draw();
</script>