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 dark and graduated blue Bar chart

A dark and graduated Bar chart. The colors are black at the bottom of the bars graduating to blue towards the top. The background grid is customised too with the horizontal grid lines having been disabled. Nor are there any labels. It uses the responsive function to enable it to reduce in size on smaller screens.

Another thing to note here is the complete lack of any labels. You don't always need to have labels on your charts, as the meaning may be clear without them - perhaps having a title elsewhere on the page. I wouldn't imagine that these use-cases are very common though - with most cases requiring at least a scale to make sense.

When the screen is smaller, not much happens - there's no text to reduce in size so the only thing that's done is the css float is removed and the marginInner is tweaked.

This goes in the documents header:
<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.bar.js"></script>
Put this where you want the graphic to show up:
<div style="float: right">
    <div style="width: 600px; height: 300px; background-color: black" id="chart-container"></div>
</div>
This is the code that generates the chart - it should be placed AFTER the div tag:
<script>
    // This is not a complicated configuration - here the data is
    // separated out to its own variable.
    data = [6,4,5,5,7,4,8];

    // There's no labels or scale on this chart - 99% of the time
    // you do want at least a scale on your chart but sometimes
    // you will be able to omit it. Other than that, an RGraph
    // gradient is being used and there's no horizontal
    // background bars.
    bar = new RGraph.SVG.Bar({
        id: 'chart-container',
        data: data,
        options: {
            yaxisLabelsColor: 'gray',
            backgroundGridColor: '#999',
            backgroundGridHlines: false,
            colors: ['Gradient(#6969FF:#6969FF:#353566)'],
            xaxisLabels: ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],
            textColor:'white',
            textSize:16,
            responsive: [
                {maxWidth: null,width:600, height: 300,options: {marginInner:15},parentCss:{'float':'right',textAlign:'none'}},
                {maxWidth: 800, width:400, height: 200,options: {marginInner:10},parentCss:{'float':'none',textAlign:'center'}}
            ]
        }
    // Draw the chart and add some responsive capabilities
    }).draw();
</script>