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 »

A 3D Line chart demonstration

Written by Richard Heyes, RGraph author, on 13th June 2021

[No canvas support]

Here's a novel new demonstration of a chart: A 3D Line chart with multiple datasets. This is not a natively supported type of chart though the code to create it, whilst big, is not complicated and it's fully annotated so you should find it easy to follow.

The next release will feature it as part of the demos that come with RGraph which are located in the demos/ folder and it will be called: demos/line-chart-3d.html. Here's an image showing it and you can see the demo in its full glory by following the link below to a codepen of it.

<script>
    //
    // Margins for the rear of the chart
    //
    marginLeft    = 90;
    marginRight   = 40;
    marginTop     = 20;
    marginBottom  = 105;
    marginInner   = 5;
    
    //
    // Colors for the lines
    //
    colors = [
        'rgba(255,0,0,0.75)',
        'rgba(0,0,255,0.75)',
        'rgba(0,128,0,0.75)'
    ];
    filledColors = [
        'rgba(255,0,0,0.5)',
        'rgba(100,100,255,0.65)',
        'rgba(0,200,0,0.75)'
    ];
    
    //
    // The line data
    //
    data = [
        [8,9,7,8,10,10,13,12,9,8,9,11,8,11,13,12,11,13,10,8,9,10,8,12,11,9,10,9,8,11],
        [8,7,6,5,6,7,5,6,8,8,8,9,5,6,8,7,5,6,6,8,7,5,6,8,7,8,6,9,9,7],
        [5,6,8,3,6,5,5,4,5,6,6,7,6,5,4,6,7,5,4,5,6,5,5,5,6,8,7,8,6,5]
    ];
    
    //
    // X axis labels
    //
    xaxisLabels = [
        '','','','Week 1','','','',
        '','','','Week 2','','','',
        '','','','Week 3','','','',
        '','','','Week 4','','','',
        '',''
    ];
    
    // The title
    title = 'Amount of sales last month';
    
    // Maximum value for the Y scale
    yaxisScaleMax = 15;
    
    // How much to transform by to get the 3D look
    transformX = -25;
    transformY = 15;
    
    
    
    
    
    
    
    
    // Set the initial transformation on the canvas in order
    // to provide the 3D look
    context = document.getElementById('cvs').getContext('2d');
    context.setTransform(1,0.1,0,1,0,0);
    
    //
    // Draw the "chart" that provides the
    // background grid. The chart is not
    // displayed - it only shows the
    // background grid
    //
    new RGraph.Line({
        id: 'cvs',
        data: [],
        options: {
            // The background grid is only enabled on this chart
            //backgroundGridDashed: false,
            //backgroundGridColor: '#333',
            
            // Set the margins based on the values that are defined above
            marginBottom: marginBottom,
            marginTop:    marginTop,
            marginLeft:   marginLeft,
            marginRight:  marginRight,
            marginInner:  marginInner,
    
            yaxisScaleMax: yaxisScaleMax,
            yaxisPosition: 'right',
            yaxisScaleUnitsPost: 'Kg',
    
            textSize: 10,
            title: title,
            titleSize: 16,
            titleOffsety: 5
        }
    }).draw();
    
    
    
    
    
    
    
    
    //
    // Draw the first chart after adjusting
    // the transformation
    //
    context.transform(1,0,0,1,transformX,transformY);
    
    new RGraph.Line({
        id: 'cvs',
        data: data[0],
        options: {
    
            colors: [colors[0]],
    
            // The background grid is only enabled on this chart - the
            // bar chart at the back
            backgroundGrid: false,
    
            marginBottom: marginBottom,
            marginTop: marginTop,
            marginLeft: marginLeft,
            marginRight: marginRight,
            marginInner: marginInner,
            
            filled: true,
            filledColors: [filledColors[0]],
    
            yaxisScaleMax: yaxisScaleMax,
            yaxisPosition: 'right',
            yaxisScale: false,
            
            linewidth: 5
        }
    }).draw();
    
    
    
    
    
    
    
    
    //
    // Draw the second line chart after adjusting
    // the transformation
    //
    context.transform(1,0,0,1,transformX,transformY);
    
    new RGraph.Line({
        id: 'cvs',
        data: data[1],
        options: {
    
            colors: [colors[1]],
    
            backgroundGrid: false,
    
            marginBottom: marginBottom,
            marginTop: marginTop,
            marginLeft: marginLeft,
            marginRight: marginRight,
            marginInner: marginInner,
            
            filled: true,
            filledColors: [filledColors[1]],
    
            yaxisScaleMax: yaxisScaleMax,
            yaxisScale: false,
            
            linewidth: 5
        }
    }).draw();
    
    
    
    
    
    
    
    //
    // Draw the third line chart after adjusting
    // the transformation
    //
    context.transform(1,0,0,1,transformX,transformY);
    
    new RGraph.Line({
        id: 'cvs',
        data: data[2],
        options: {
    
            colors: [colors[2]],
    
            backgroundGrid: false,
    
            marginBottom: marginBottom,
            marginTop: marginTop,
            marginLeft: marginLeft,
            marginRight: marginRight,
            marginInner: marginInner,
            
            filled: true,
            filledColors: [filledColors[2]],
    
            yaxisScaleMax: yaxisScaleMax,
            yaxisScale: false,
            
            // The X axis labels are shown on this chart
            textSize: 10,
            
            linewidth: 5,
            
            xaxisLabels: xaxisLabels
        }
    }).draw();
</script>