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 »

 

SQLite Editor 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.


23rd June, Richard
The SQLite Editor for PHP admin tool is now available for you to download

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

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 SVG filled and stacked Line chart

An SVG version of an older filled spline Line chart. The chart uses gradients as the fill colors. There's also a key defined.

This is an SVG version of an older canvas demo that has been updated to be a bit more up-to-date style-wise.

The vertical lines on the grid have been removed, the X-axis and Y-axis have been removed and instead of being angular the line is now a spline (ie it's curvy).

Also, it now uses the trace animation effect. The chart is filled and the filledAccumulative option is set to true so that the three datasets are stacked on top of each other.

Other than this there's a key, a title and the yaxisScaleUnitsPost has been set. The chart is also responsive and on smaller screens, the size of the SVG tag is reduced, text size is reduced and the CSS float is removed.

This goes in the documents header:
<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.common.key.js"></script>
<script src="RGraph.svg.line.js"></script>
Put this where you want the chart to show up:
<div style="float: right">
    <div style="width: 600px; height: 300px" id="cc"></div>
</div>
This is the code that generates the chart - it should be placed AFTER the div tag:
<script>
    // Create the Line chart and give it the three datasets.
    new RGraph.SVG.Line({
        id: 'cc',
        data: [
            [4,6,12,16,8,4,2,8,18,16,14,16],
            [2,4,8,4,2,6,6,12,8,10,6,8],
            [1,3.5,5,3,4,5,6,11,8,9,5,7]
        ],
        options: {
            // Define a key. SVG charts only support a margin based key.
            // For a graph based key you'll need to use the canvas
            // libraries.
            key: ['Robert','Daniel','Janice'],
            keyColors: ['#faa', '#aaf', '#7c7'],

            xaxisLabels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
            marginTop: 55,
            marginRight: 15,
            marginLeft: 50,
            marginBottom: 50,
            colors: ['#666', '#666', '#666'],
            
            
            // Stipulate that the chart should be filled and accumulative.
            // Being accumulative means that the datasets are stacked on
            // top of each other. This means that the total of the datasets
            // is clearer compared to when the datasets are non-accumulative
            // (ie they're just drawn one on top of the other). This may
            // suit you better if you need to see the combined totals.
            filled: true,
            filledAccumulative: true,
            filledColors: ['Gradient(red:white)', 'Gradient(blue:white)', 'Gradient(green:white)'],

            yaxisScaleUnitsPost: '%',
            linewidth: 0.001,
            marginInner: 0,
            title: 'Robert, Daniel and Janices stats',
            textColor: '#333',
            textFont: 'Arial',
            
            // Stipulate that the Line is a spline (ie curvy instead of angular)
            spline: true,

            responsive: [
                {maxWidth:null,width:600,height:300,options:{textSize: 12},parentCss:{'float':'right',textAlign:'none'}},
                {maxWidth:900,width:450,height:250,options:{textSize: 10},parentCss:{'float':'none',textAlign:'center'}}
            ]
        }
    
    // Use the trace effect to show the chart and add some responsive capability
    }).trace();
</script>