# An SVG HBar chart showing late excuse numbers

A Horizontal Bar chart with a large left gutter setting. With HBar charts the left gutter setting is auto-sized by default to make sufficient room for the labels. The chart is animated using the grow effect and the labelsAbove option is enabled.

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: 500px" id="chart-container"></div>
    </div>

This is the code that generates the chart:

    <script>
        new RGraph.SVG.HBar({
            id: 'chart-container',
            data: [12, 7, 26, 5, 14],
            options: {
                backgroundGridBorder: false,
                yaxisColor: '#ddd',
                xaxisColor: '#ddd',
                backgroundGridHlines: false,
                colors: ['#4F81BD'],
                vmargin: 25,
                yaxisLabels: [
                    'I had no clean pants to wear',
                    'I thought it was Saturday',
                    'I forgot to set my alarm',
                    'It was still too dark, I thought it was nighttime',
                    'I got stuck in traffic'
                ],
                labelsAbove: true,
                labelsAboveColor: '#333'
            }
        }).grow();
    </script>