# An example of a RScatter chart with an interactive key

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

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="500" height="450">
        [No canvas support]
    </canvas>

This is the code that generates the chart:

    <script>
        window.onload = function ()
        {

            var data1 = [[45,51,'green'],[45,46,'green'],[45,35,'green']];
            var data2 = [[225,32,'red'],[225,25,'red'],[225,12,'red']];
            var data3 = [[315,13,'pink'],[315,26,'pink'],[315,36,'pink']];

            var rscatter = new RGraph.RScatter({
                id: 'cvs',
                data: [data1, data2, data3],
                options: {
                    key: ['Richard','Dave','Charles'],
                    keyInteractive: true,
                    keyColors: ['green','red','pink'],
                    keyMargin: 5,
                    keyLabelsAxes: 'n',
                    textAccessible: true
                }
            }).draw();
        };
    </script>