Mention RGraph on Twitter

RGraph: HTML5 Javascript charts library - The RGraph.SetConfig() function

[No canvas support]

Instead of using a number of .Set() calls, you may find that using the RGraph.SetConfig() method more to your tastes. The method is an alternative to setting the configuration of your chart. It doesn't offer any speed benefits, but it can facilitate reuse better, so that the appearance of your websites charts is the same. There's an example of its use below:


<script>
    window.onload = function ()
    {
        /**
        * This configuration could be stored in a central configuration file, making its reuse easier. You could also have
        * several different configurations that you pick and choose from depending on the requirements. Values in
        * subsequent calls to .SetConfig() will overwrite previous ones.
        */
        var config = {
                      'chart.colors':                  ['red', 'green'],
                      'chart.labels':                  ['John','Fred','June','Charles','Lou', 'Olga'],
                      'chart.title.yaxis':             'Amount',
                      'chart.title.yaxis.pos':         -0.2,
                      'chart.title.xaxis':             'Person',
                      'chart.background.grid.autofit': true,
                      'chart.title': 'A chart showing RGraph.SetConfig()'
                     }
        var bar = new RGraph.Bar('cvs', [48,56,52,49,43,51]);
        RGraph.SetConfig(bar, config);
        bar.Draw();
    }
</script>