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.

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 »

Combining charts

The addition of the ObjectRegistry brings a new level of functionality to RGraph by allowing the combination of charts that also have dynamic features such as tooltips. You can find examples of combining charts in the download archive.

The source code for a combined Bar chart and Line chart is as follows:


<script>
    bar = new RGraph.Bar({
        id: 'cvs',
        data: [5,4,8,7,6,3,6],
        options: {
            marginTop: 5,
            marginRight: 250,
            xaxisLabels: ['John','Fred','Louis','Peter','Karl','Julie','Olga'],
            tooltips: ['John','Fred','Louis','Peter','Karl','Julie','Olga'],
            textSize: 14
        }
    });
    
    line = new RGraph.Line({
        id: 'cvs',
        data: [1.5,2.5,2.1,1.3,1.9,2.1,1.1],
        options: {
            linewidth: 3,
            colors: ['black'],
            yaxisScaleMax: 10,
            tickmarksStyle: 'endcircle',
            tickmarksSize: 7,
            tooltips: ['Charles','Rick','Huey','Pob','Kevin','Louis','John'],
            textSize: 14
        }
    });

    combo = new RGraph.CombinedChart(bar, line);
    combo.draw();

    // Create the  larger Pie chart
    pie = new RGraph.Pie({
        id: 'cvs',
        data: bar.data,
        options: {
            centerx: 375,
            radius: 45,
            labels: bar.get('xaxisLabels'),
            tooltips: bar.get('xaxisLabels'),
            textSize: 14
        }
    })

    pie.draw();
</script>

Combining the Bar and Line chart

The Bar chart and Line chart is a common combination so there's a specific class for it - the RGraph.CombinedChart class. This is a specific class that configures the Bar and Line appropriately. The CombinedChart class can be used to combine any type of chart but it only specifically configures the Bar and Line charts. If you use this class the Bar chart should be the first object that you pass to it.


<script>
    labels = ['Charles','Rick','Huey','Pob','Kevin','Louis','John'];

    bar = new RGraph.Bar({
        id: 'cvs',
        data: [4,6,3,5,8,4,9],
        options: {
            colors: ['#ccf'],
            title: 'An example of a combined Bar and Line chart',
            xaxisLabels: labels,
            tooltips: labels,
            combinedEffect: 'wave',
            textSize: 14
        }
    });

    line = new RGraph.Line({
        id: 'cvs',
        data: [25,13,46,15,26,30,3],
        options: {
            tickmarksStyle: 'endcircle',
            tickmarksSize: 7,
            combinedEffect: 'trace',
            textSize: 14
        }
    });
    
    combo = new RGraph.CombinedChart(bar, line);
    combo.draw();

    line.set({
        yaxisPosition: 'right',
        yaxisScale: true
    });
</script>

Supplying the objects as an array and the CombinedChart Add() method

Two other options to supplying the objects as separate arguments to the CombinedChart constructor is to supply them in one array to the constructor - you can give as many objects as you wish. And you can also use the CombinedCharts Add method to add objects to the CombinedChart. Both of these methods may help when you're programmatically adding objects to the combination.

Old charts keep reappearing when drawing multiple charts on one canvas

Since the ObjectRegistry was introduced (facilitating combining charts) objects have to be registered regardless of whether they use dynamic features or not. As a result of this you may be experiencing objects being redrawn when you don't want them to be. To solve this you need to remove them from the ObjectRegistry. How to do this is documented here: How to remove objects from the ObjectRegistry.

More examples of combining charts

Here are more examples of combining different charts. You can also find an example of this in in the download archive (line-multiple-y-axes.html)