A grouped SVG Bar chart using the CSV reader

The CSV reader demonstrated by reading CSV data via AJAX and showing a grouped Bar chart. Other than the CSV reader it's a pretty normal grouped Bar chart that uses the grow() effect.

Note: For browser security reasons the AJAX demos don't work offline (this demo is using the CSV reader option that reads data that's embedded in the page itself). You can view the demos on the RGraph website here: https://www.rgraph.net/demos/index.html#svg and this demo is available here: http://www.rgraph.net/demos/svg-bar-csv2.html

This goes in the documents header:
<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.common.ajax.js"></script>
<script src="RGraph.svg.common.csv.js"></script>
<script src="RGraph.svg.bar.js"></script>
Put this where you want the chart to show up:
<div style="width: 750px; height: 300px" id="chart-container"></div>
    [No canvas support]
</div>
This is the code that generates the chart:
<script>
    new RGraph.CSV('/sample.csv', function (csv)
    {
        var numrows = csv.numrows,
            rows    = [],
            row     = [],
            labels  = [];
    
        for (var i=0; i<numrows; ++i) {
            
            var row   = csv.getRow(i, 1).slice(0,3);
            var label = csv.getRow(i).slice(0,1)[0];

            rows.push(row);
            labels.push(label);
        }

        new RGraph.SVG.Bar({
            id: "chart-container",
            data: rows,
            options: {
                marginLeft: 50,
                yaxisScaleUnitsPost: 'k',
                colors: ['red','green', 'blue'],
                hmargin: 10,
                xaxis: false,
                yaxis: false,
                backgroundGridBorder: false,
                backgroundGridVlines: false,
                xaxisLabels: labels
            }
        }).grow();
    });
</script>