RGraph is a JavaScript charts library based on HTML5 SVG and canvas. RGraph is mature (over 15 years old) and has a wealth of features making it an ideal choice to show charts on your website.

More »


Get the latest version of RGraph (version 6.17) from the download page. There's also older versions available, minified files and links to cdnjs.com hosted libraries.

More »


RGraph can be used for free under the GPL or if that doesn't suit your situation there's an inexpensive (£99) commercial license available.

More »

A blue SVG Horizontal Bar chart

Here's a Horizontal Bar chart that has been significantly customised. The div tag that the chart sits in has had a gradient applied to the background and two of the corners are curved, using the border-radius css property. The bars themselves have been given a gradient, the background grid has been updated so that there's no border and the horizontal grid lines have been disabled. The labelsAbove option has been added and the chart uses the wave effect.

To get a different gradient for each bar, the colorsSequential has been enabled and five different gradients have been supplied to the colors option.

The size of the text has been reduced from the default to 8pt.

As far as responsive features go, the chart simply reduces in size when the screen size is smaller - no options are changed.

This goes in the documents header:
<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.hbar.js"></script>
Put this where you want the chart to show up:
    * Here's some CSS to configure the appearance of the div tag
    * that the chart is added to. There's the background gradient
    * as well as two of the corners being rounded.
    div#chart-container {
        background-image: linear-gradient(45deg, #000049,#0000CB);
        border-bottom-right-radius: 25px;
        border-top-left-radius: 25px;

<div style="float: right">
    <div id="chart-container"></div>
This is the code that generates the chart - it should be placed AFTER the div tag:
    // Create the HBar chart. There's only a small amount of data given
    // to the chart.
    new RGraph.SVG.HBar({
        id: 'chart-container',
        data: [2650, 2300, 1950, 1600, 1350],
        options: {
            yaxisLabels: ['2005','2004', '2003', '2002','2001'],
            yaxisColor: 'white',
            yaxisTickmarks: null,
            xaxis: false,
            // Turn off the background grid horizontal lines
            backgroundGridHlines: false,
            backgroundGridBorder: false,
            backgroundGridColor: 'white',

            title: 'Annual revenue for Star Tech',
            textColor: 'white',
            textSize: 8,
            // Use the RGraph short gradient syntax to add some colors
            // to the chart.
            colors: [
            // So that all of the bars are a separate color (as defined
            // above) the colorsSequential option should be given.
            colorsSequential: true,

            labelsAbove: true,
            xaxisScaleUnitsPre: '$',
            xaxisScaleUnitsPost: 'm',
            // Add a responsive configuration that resizes the
            // chart when you use a smaller screen
            responsive: [
                {maxWidth:800, width:400,height:250,parentCss:{'float':'none',textAlign:'center'}}
    // Draw the chart