# An SVG Bar chart with error-bars

A demonstration of using the Bar chart with errorbars. Errorbars work with regular, grouped and stacked data, positive or negative.

This goes in the documents header:

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

Put this where you want the chart to show up:

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

This is the code that generates the chart:

    <script>
        bar = new RGraph.SVG.Bar({
            id: 'chart-container',
            data: [[4,8,6],[5,3,6],0,[-5,-6,-4],[-5,-6,-4]],
            options: {

                errorbars: [
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1},
                    {min:1, max:1}
                ],
                errorbarsColor: 'black',
                errorbarsLinewidth: 1,
                //errorbarsCapwidth: 20,

                colors: [
                    'Gradient(red:#c00)',
                    'Gradient(#0f0:#c00)',
                    'Gradient(#00f:#ccc)'
                ],
                hmargin: 20,
                xaxisLabels: ['Harry','Pete','Lucy','Paul'],

                //xaxis: false,
                yaxis: false,
                yaxisMin: 'mirror',
                backgroundGridVlines: false,
                backgroundGridBorder: false,
                shadow: true
            }
        }).grow();
    </script>