An SVG Scatter chart using the Google Sheets connector

An example of using the Google sheets connector to retrieve data from a Google Sheets spreadsheet. The data that's retrieved is combined and used as the Scatter chart coordinates.

This goes in the documents header:
<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.common.sheets.js"></script>
<script src="RGraph.svg.scatter.js"></script>
Put this where you want the chart to show up:
<div style="width: 1000px; height: 300px" id="chart-container"></div>
This is the code that generates the chart:
<script>
    new RGraph.Sheets('1ncvARBgXaDjzuca9i7Jyep6JTv9kms-bbIzyAxbaT0E', function (sheet)
    {
        var data1   = sheet.get('B2:B13'),
            data2   = sheet.get('C2:C13'),
            data    = [];
        
        // Get the data
        for (var i=0; i<data1.length; i++) {
            data.push({x: data1[i], y: data2[i]});
        }

        new RGraph.SVG.Scatter({
            id: 'chart-container',
            data: data,
            options: {
                marginTop: 50,
                textSize: 10,
                xaxisLabels: ['Q1','Q2','Q3','Q4'],
                yaxis: false,
                backgroundGridColor: '#eee',
                backgroundGridVlines: false,
                backgroundGridBorder: false,
                xaxisColor: '#333',
                xaxisScaleMax: 50,
                title: 'A Scatter chart using the Google Sheets connector'
            }
        }).draw();
    });
</script>