A Bar chart using AJAX


Note: For browser security reasons the AJAX demos don't work offline. You can view the demos on the RGraph website here: https://www.rgraph.net/demos/index.html



[No canvas support]

This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.bar.js"></script>
Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="250">
    [No canvas support]
</canvas>
This is the code that generates the chart:
<script>
    drawGraph = function (data)
    {
        var bar = new RGraph.Bar({
            id: 'cvs',
            data: data,
            options: {
                colors: ['red'],
                xaxisLabels: ['John', 'Fred', 'Joe', 'Rich', 'Pete', 'Lilly', 'Fred', 'Joe', 'Rich', 'Pete'],
                yaxisTickmarksCount: 5,
                yaxisLabelsCount: 5,
                marginLeft: 35,
                variant: '3d',
                colorsStroke: 'transparent',
                hmarginGrouped: true,
                yaxisScaleRound: true,
                backgroundGridVlines: false,
                backgroundGridBorder: false,
                shadowOffsetx: 10,
                marginBottom: 75,
                axes: false
            }
        }).draw();
    }
    
    RGraph.AJAX.getCSV('/getdata.html', drawGraph);
</script>