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 »

 

SQLiteEditor for PHP
The SQLite Editor for PHP software is a tool which will help you and/or your users administer and maintain your SQLite databases. Built as a tool that you can easily provide to your users, there's no danger of them damaging your database.

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 »

A black and purple combined chart

[No canvas support]

This demo is an example of a combined Bar and Line. In this case, the Line is a spline but it doesn't have to be. In fact there's a button beneath the chart that you can use to toggle whether it's a spline (curvy) or a regular angular Line. All this button does is toggle the spline setting and then redraw the canvas.

In RGraph, combining a Bar chart and a Line chart is made easy by the CombinedChart class. You can see this being used in the code below. It simply takes the Bar and the Line objects and sets the correct settings on them and then draws the chart. But normally you would want only one set of labels (ie the Bar or the Line) drawn, however here the Bar charts labels are on one side and the Line chart labels are on the other. So after the combo class has been drawn, the y-axis labels are turned back on for the Line chart object and everything is redrawn. You can see how this is done in the code below.

The CombinedChart class is freely usable by you in a very similar way to the other RGraph classes. It's created in the same way and you pass it an array of objects - which usually is a combination of Bar and Line objects. You can give it more types if you want.

Apart from this, the chart has "larger than the default" text and the Bar uses a gradient for the fill color: Gradient(#A18AC5:#D1AAF5)

The responsive function reduces the size of the chart, the size of the text on the chart and the margins. The function is added to both the Bar and the Line chart and the Line chart version also reduces its linewidth.


This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.bar.js"></script>
<script src="RGraph.line.js"></script>
Put this where you want the chart to show up:
<div style="float: right; display: inline-block; margin: 25px">
    <canvas id="cvs" width="750" height="250" style="background-color: #555; border: 5px solid black; border-radius: 7px">[No canvas support]</canvas><br />
    <button style="border-radius: 5px; font-size: 20px; margin: 10px; padding: 7px" onclick="line.set('spline', !line.get('spline')); RGraph.redraw()">Toggle spline</button>
</div>
This is the code that generates the chart - it should be placed AFTER the canvas tag(s):
<script>
    bar = new RGraph.Bar({
        id: 'cvs',
        data: [81,90,75,85,90,78,61],
        options: {
            yaxisScaleMax: 100,
            backgroundGridColor: '#999',
            xaxisLabels: ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],
            marginLeft: 55,
            marginRight: 55,
            marginBottom: 45,
            colors: ['Gradient(#A18AC5:#D1AAF5)'],
            textColor: '#ccc',
            combinedEffect: 'wave',
            combinedEffectOptions: '{frames: 30}',
            responsive: [
                {maxWidth: null,width:600,height:250,options:{textSize:14,marginInner: 20}},
                {maxWidth: 900, width:400,height:200,options:{textSize:12,marginInner: 7}}
            ]
        }
    });



    line = new RGraph.Line({
        id: 'cvs',
        data: [150,255,566,542,588,122,131],
        options: {
            yaxisScaleMax: 600,
            backgroundGrid: false,
            colors: ['#d00'],
            yaxisPosition: 'right',
            textColor: '#ccc',
            marginLeft: 45,
            marginRight: 45,
            spline: true,
            combinedEffect: 'trace',
            textSize: 18,
            responsive: [
                {maxWidth: null,options:{textSize:14,marginInner: 45,linewidth: 7}},
                {maxWidth: 900, options:{textSize:12,marginInner: 20,linewidth: 5}}
            ]
        }
    });
    
    combo = new RGraph.CombinedChart([bar, line])
        .draw();
    
    // Because the combo class turns the Line chart labels off,
    // turn them back on
    line.set({
        yaxisScale: true
    });

    RGraph.redraw();
</script>