# A Bar chart using the Google Sheets connector

This goes in the documents header:

    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.common.sheets.js" ></script>
    <script src="../libraries/RGraph.bar.js" ></script>

Put this where you want the chart to show up:

    <canvas id="cvs" width="800" height="400">
        [No canvas support]
    </canvas>

This is the code that generates the chart:

    <script>
        new RGraph.Sheets('1ncvARBgXaDjzuca9i7Jyep6JTv9kms-bbIzyAxbaT0E', function (sheet)
        {
            var data   = sheet.get('B2:B13');
            var labels = sheet.get('A2:A13');

            for (var i=0; i<labels.length; i+=2) {
                labels[i] = "\n" + labels[i];
            }

            var bar = new RGraph.Bar({
                id: 'cvs',
                data: data,
                options: {
                    labels: labels,
                    colors: ['#f66'],
                    shadow: false,
                    strokestyle: 'rgba(0,0,0,0)',
                    scaleZerostart: true,
                    noaxes: true,
                    gutterLeft: 50,
                    gutterBottom: 70,
                    textAccessible: true,
                    backgroundGridVlines: false,
                    backgroundGridBorder: false,
                    textSize: 16
                }
            }).wave();
        });
    </script>