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 DateTime Scatter chart

[No canvas support]

This demo shows how you can use date/time values as X-axis values with the Scatter chart. Although it's a Scatter chart it can also show a line that connects the points, as you can see on the example to the right. The chart has two datasets, one of which is set to be drawn as being stepped.

The date/time format parsing in RGraph is done by the RGraph.parseDate function internally and this function is quite versatile in the formats that it accepts.

This means that you are free to use many different formats for the date/time values that you supply. Some of the different formats that are accepted are shown in the source code below.

For smaller screens, the text size is reduced and the css float is reduced.


This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.scatter.js"></script>
Put this where you want the chart to show up:
<div style="float: right">
    <canvas id="cvs" width="600" height="200">[No canvas support]</canvas>
</div>
This is the code that generates the chart - it should be placed AFTER the canvas tag(s):
<script>
    // The first dataset - the set of points that are drawn on
    // to the chart. Note the different formats of the date/time
    // values.
    data1 = [
        ['2012-02-12 15:51:55', 5],
        ['2012-03-01 21:45',10],
        [],
        [],
        ['August 15 2012',7],
        ['15 Nov 2012', 16]
    ];
    
    // The second set of points that are drawn on to the chart
    data2 = [
        ['5th January 2012 12:45', 6],
        ['2012 Mar 05 09:45',17],
        ['2012/05/05 12:48:45',13],
        ['2012/09/09 15:45:45',19],
        ['2012/12/31 23:59:59',2]
    ];

    new RGraph.Scatter({
        id: 'cvs',
        data: [data1, data2],
        options: {
            colorsDefault: ['red','black'],
            
            // Stipulate the start of year (ie the minimum value of the chart)
            xaxisScaleMin: '2012-01-01',
            
            // Stipulate the end of year (ie the maximum value of the chart)
            xaxisScaleMax: '2012-12-31 23:59:59',
            
            // Add X-axis labels
            xaxisLabels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
            
            // Configure the line that connects the tickmarks
            line: true,
            lineLinewidth: 2,
            lineColors: ['red','black'],
            
            // The value can either be a boolean (ie true or false) or an
            // array of booleans - with one entry per dataset.
            lineStepped: [false, true],
            
            tickmarksStyle: 'circle',
            tickmarksSize: 10,

            responsive: [
                {maxWidth: null,width:600,height:200,options:{textSize:12},parentCss:{'float':'right',textAlign:'none'}},
                {maxWidth: 900,width:400,height:200,options:{textSize:10},parentCss:{'float':'none',textAlign:'center'}}
            ]
        }
    
    // Draw the chart and add some responsive capabilities so that it fits well on smaller
    // screens
    }).draw();
</script>