An example of a Bar chart with an interactive key

The interactive key has been re-implemented as of June 2013 and added to more chart types.

[No canvas support]

This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.dynamic.js"></script>
<script src="RGraph.common.key.js"></script>
<script src="RGraph.drawing.rect.js"></script>
<script src="RGraph.bar.js"></script>
Put this where you want the chart to show up:
<canvas id="cvs" width="800" height="250">
    [No canvas support]
</canvas>
This is the code that generates the chart:
<script>
    window.onload = function ()
    {
        var bar = new RGraph.Bar({
            id: 'cvs',
            data: [[8,4,1],[4,8,8],[1,2,2],[3,3,4],[6,5,2],[5,8,8],[4,8,5]],
            options: {
                textAccessible: true,
                key: ['Jim','Jack','Joseph'],
                keyInteractive: true,
                keyTextSize: 14,
                keyPosition: 'gutter',
                backgroundGridVlines: false,
                backgroundGridBorder: false,
                shadow: false,
                labels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
                textSize:14,
                strokestyle: 'rgba(0,0,0,0)',
                hmargin: 25,
                hmarginGrouped: 2,
                noyaxis: true
            }
        }).draw()
    };
</script>

Share on Facebook Share on Twitter

<Back