# An SVG HBar chart with a center(ish) Y axis

This goes in the documents header:

    <script src="RGraph.svg.common.core.js"></script>
    <script src="RGraph.svg.hbar.js"></script>

Put this where you want the chart to show up:

    <div style="padding: 15px">
        <div style="width: 750px; height: 350px" id="chart-container"></div>
    </div>

This is the code that generates the chart:

    <script>
        new RGraph.SVG.HBar({
            id: 'chart-container',
            data: [[14,16],[16,13],[24,28],[26,21],[23,18],[29,26],[-12,-19]],
            options: {
                vmargin: 10,
                colors: ['rgba(129,0,1,0.5)','rgba(2,2,253,0.5)'],
                xaxis: false,
                xaxisMax: 30,
                xaxisMin: -20,
                yaxisLabels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
                backgroundGridHlines: false,
                backgroundGridBorder: false
            }
        }).grow();
    </script>

« Back