A stacked horizontal bar chart

[No canvas support]

This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.key.js"></script>
<script src="RGraph.hbar.js"></script>
Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="300">
    [No canvas support]
</canvas>
This is the code that generates the chart:
<script>
    var hbar = new RGraph.HBar({
        id: 'cvs',
        data: [[8,6,4,3], [4,8,3,5],[4,9,9,7],[6,5,3,4],[3,7,8,8]],
        options: {
            grouping: 'stacked',
            hmargin: 20,
            labels: ['Charlie','Jake','Luis','Jack','Bernie'],
            key: ['Monday','Tuesday','Wednesday','Thursday'],
            keyPosition: 'gutter',
            keyPositionGutterBoxed: false,
            keyColors: ['#3366CC','#DC3912','#FF9900','#109618'],
            keyTextSize: 16,
            colors: [
                'Gradient(white:#3366CC:#3366CC)',
                'Gradient(white:#DC3912:#DC3912)',
                'Gradient(white:#FF9900:#FF9900)',
                'Gradient(white:#109618:#109618)'
            ],
            scaleZerostart: true,
            noxaxis: true,
            axisColor: '#999',
            textSize: 20,
            gutterTop: 30,
            gutterBottom: 20,
            gutterLeft: 95,
            gutterRight: 25,
            textAccessible: true
        }
    }).grow();
</script>

Share on Facebook Share on Twitter

« Back