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 Pie chart using Google Sheets

An SVG Pie chart using the Google Sheets connector. The Pie chart gets its data and labels from the spreadsheet.

This is a demo of a chart being created by using the Google Sheets connector that's bundled with RGraph. You can see the Google Sheet that RGraph is fetching data from here and the documentation for the Google Sheets Connector here.

It's using the data that's on the Bar worksheet (there are multiple buttons at the bottom of the screen that allows you access to the other worksheets). The labels are coming from the spreadsheet too.

The stroke color is set to white and the linewidth is 2. There's no other configuration so the Pie chart looks quite standard, though there is a responsive configuration so that on smaller screens the labels disappear and tooltips are used instead.


This goes in the documents header:
<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.common.sheets.js"></script>
<script src="RGraph.svg.pie.js"></script>
Put this where you want the chart to show up:
<div style="float: right">
    <div style="width: 650px; height: 300px" id="chart-container"></div>
</div>
This is the code that generates the chart - it should be placed AFTER the div tag:
<script>
    // A pretty basic Pie chart that doesn't do anything particularly magical.
    // The only thing that's worthy of note here is the fact that it gets its
    // data via the Google Sheets import tool. The key for the spreadsheet
    // (the unique identifier) can be found in the URL and is this:
    //
    // 1ncvARBgXaDjzuca9i7Jyep6JTv9kms-bbIzyAxbaT0E
    //
    // This, along with a callback function that creates the chart and the OAuth ID,
    // are given to the Sheets object constructor. The optional 3rd argument for the
    // Sheets constructor specifies the worksheet to use and has been set to
    // "Bar chart".
    //
    // Remember that the Google Sheets import tool can be used standalone - ie
    // without the RGraph core library. Along with the GPLv2 license,
    // this means that you are free to incorporate it into your own projects
    // or tools if you want to.
    new RGraph.Sheets(
        'AIzaSyBPofvjcDhOdet_U2Tr4-rSLItAgaCsMCM',
        '1ncvARBgXaDjzuca9i7Jyep6JTv9kms-bbIzyAxbaT0E',
        'Bar chart', // Use the data from the "Bar chart" sheet
    function (sheet)
    {
        // Get the data and the labels from the spreadsheet. Note that you can
        // use the familiar row and column names to get the data.
        var data   = sheet.get('B2:B13'),
            labels = sheet.get('A2:A13');

        new RGraph.SVG.Pie({
            id: 'chart-container',
            data: data,
            options: {
                labels: labels,
                colorsStroke: 'white',
                linewidth: 2,
                textSize: 10,
                tooltipsCss: {
                    fontSize:'16pt'
                },
                responsive: [
                    {maxWidth: null, width: 650, height: 300, options: {labels: labels, tooltips: null,title: ''},parentCss:{'float':'right',textAlign:'none'}},
                    {maxWidth: 900,  width: 400, height: 300, options: {labels: [], tooltips: labels,title: '(Click for labels)'},parentCss: {'float':'none',textAlign:'center'}}
                ]
            }
        
        // Draw the chart and add some responsive accommodation
        }).draw();
    });
</script>