A Scatter chart with background horizontal bars

[No canvas support]

This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.scatter.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>
    window.onload = function ()
    {
        var line = new RGraph.Scatter({
            id: 'cvs',
            data: [[45,36],[156,32],[142,23],[256,59],[123,48]],
            options: {
                xmax: 365,
                ymax: 60,
                labels: ['Q1','Q2','Q3','Q4'],
                ylabelsCount: 6,
                numyticks: 12,
                backgroundHbars: [
                    [0,45,'rgba(0,255,0,0.2)'],
                    [45,10,'rgba(255,255,0,0.2)'],
                    [55,5,'rgba(255,0,0,0.2)']
                ],
                textAccessible: true
            }
        }).draw();
    };
</script>

Share on Facebook Share on Twitter

« Back