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: http://www.rgraph.net/demos



[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'],
                    labels: ['John', 'Fred', 'Joe', 'Rich', 'Pete', 'Lilly', 'Fred', 'Joe', 'Rich', 'Pete'],
                    numyticks: 5,
                    ylabelsCount: 5,
                    gutterLeft: 35,
                    variant: '3d',
                    textAccessible: true,
                    strokestyle: 'transparent',
                    hmarginGrouped: true,
                    scaleRound: true,
                    backgroundGridVlines: false,
                    backgroundGridBorder: false,
                    shadowOffsetx: 10,
                    gutterBottom: 75,
                    noaxes: true
            }
        }).draw();
    }
    
    RGraph.AJAX.getCSV('/getdata.html', drawGraph);
</script>

Share on Facebook Share on Twitter

« Back