MENU
.net Powerful JavaScript charts
About
RGraph is a JavaScript charts library based on HTML5 SVG and canvas. RGraph is mature (over 17 years old) and has a wealth of features making it an ideal choice to use for showing charts on your website.

More »

 

New datagrid in v6.21
In version 6.21 a new datagrid object has been added. This makes it easy to add static or dynamic data tables to your pages. It can be used whether you use the canvas or SVG libraries or entirely standalone.

Read more »

 

Download
Get the latest version of RGraph (version 6.21, 10th April 2025) 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 »

 

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 »

The new RGraph DataGrid

Written by Richard Heyes, RGraph author, on 24th February 2025

Here's a demonstration of the new DataGrid that's coming in RGraph version 6.21 that I previously mentioned. You can click on the columns to sort the table by that column (if enabled) and the columns are resizable by grabbing in between the columns in the header row. You can also edit the column if you want to by double-clicking on the cell.

There's more work on it to be done, but I think that you'll agree that it's already looking and functioning rather nicely. By using this datagrid on your page along with the RGraph charts and a smattering of ajax you could make yourself quite a nice little client-side application that saves its data to your server.

If you look at the source code of this page you'll see that the datagrid library is inlined which is obviously not great for code reuse and you wouldn't do that normally. You would just use the library as you do other RGraph libraries. Here's a full code example that produces the table shown here:

<div style="margin-left: auto; margin-right: auto; width: 75%" id="myDatagrid"></div>

<script>
    data = [
        ['Bill','Orange',7.3,'Oranges are not the only fruit', 9],
        ['Richard','Apple',9,'Green', 9],
        ['John','Cherry',5,'Red', 10],
        ['Fred','Mango',3.8,'Yellow',6],
        ['Lucy','Pineapple',7000.7,'Yellow',4000]
    ];
        
    new RGraph.DataGrid({
        id: 'myDatagrid',
        data: data,
        options: {
            columnsHeaders: ['Operator','Fruit','Weight','Color','Price'],
            //columnsFooters: ['','','','',''],
            columnsUnitsPre: [,,,,'$'],
            columnsUnitsPost: [,,'kg'],
            //columnsThousand: [],
            //columnsPoint: [],
            columnsDecimals: [,,1,,2],
            //columnsFormatter:[],
            //columnsClick: [],
            sortable: true,
            sortableColumns: [4,2],
            editable: true,
            resizable: true
        }
    }).draw();
</script>