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.


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
1st June, Ouja
How do I add a click event to a bar in my Bar chart?


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 »

An example of an interactive key

[No canvas support]

The interactive key was updated in June 2013 and added to more chart types. The types of charts that now support the interactive key are:

The interactive key uses the RGraph.common.dynamic.js library and the RGraph.common.core.js libraries so you'll need to include these in your page if you want your chart to show a dynamic key. Apart from that the only additional property that you need to specify in your chart configuration is this: keyInteractive: true.

There's not a lot more going on for this chart except for having angled labels (at 25 degrees) and the groups of bars are made clear by using the marginInner and marginInnerGrouped properties. The chart also uses the wave animation effect.

For smaller screens the text size is reduced, the margins are changed (both the RGraph margins and also the css margins of the canvas tag) and the css float is removed.

This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.dynamic.js"></script>
<script src="RGraph.common.key.js"></script>
<script src="RGraph.drawing.rect.js"></script>
<script src="RGraph.bar.js"></script>
Put this where you want the chart to show up:
<div>
    <canvas id="cvs" width="600" height="250" style="float: right; margin-bottom: 50px">[No canvas support]</canvas>
</div>
This is the code that generates the chart - it should be placed AFTER the canvas tag(s):
<script>
    // Create a grouped Bar chart. Note that the data is a 2D array.
    new RGraph.Bar({
        id: 'cvs',
        data: [[8,4,1],[4,8,8],[1,2,2],[3,3,4],[6,5,2],[5,8,8],[4,8,5]],
        options: {

            // Specify the key as you would normally
            key: ['Jim','Jack','Joseph'],
            
            // This makes the key interactive - ie you can click on the key elements
            // and areas on the chart are highlighted. There are other libraries which
            // are also necessary for it to work -
            keyInteractive: true,
            
            // Specify the highlight colors for the interactive key highlight
            keyInteractiveHighlightChartStroke: 'transparent',
            keyInteractiveHighlightChartFill: 'rgba(255,255,255,0.75)',
            
            // This is the size of the key text
            keyTextSize: 10,

            // This can be 'margin' or 'graph' and determines the position of the key
            keyPosition: 'margin',

            backgroundGrid: false,
            textSize:18,
            marginInner: 10,
            marginInnerGrouped: 1,
            marginLeft: 45,
            responsive: [
                {maxWidth: null, width:600,height:350, options: {marginBottom: 135,xaxisLabelsOffsety: 10,xaxisLabelsAngle: 25,xaxisLabels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],textSize:14,marginInner:10},css: {marginBottom: 0,'float': 'right'},parentCss:{textAlign:'none'}},
                {maxWidth: 900,width: 400,height: 250,options: {marginBottom: 45,xaxisLabelsOffsety: 0,xaxisLabelsAngle: 0,xaxisLabels:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],textSize: 10,marginInner:5},css: {marginBottom: '35px','float': 'none'},parentCss:{textAlign:'center'}}
            ]
        }
    }).wave()
</script>