A combined Bar and Pie chart

This is the chart that was used on the front page (as of 13th December 2013)

[No canvas support]

This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.dynamic.js"></script>
<script src="RGraph.common.tooltips.js"></script>
<script src="RGraph.pie.js"></script>
<script src="RGraph.bar.js"></script>

<link rel="stylesheet" href="../css/animate.css" type="text/css" media="screen" />
Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="250">
    [No canvas support]
</canvas>
This is the code that generates the chart:
<script>
    window.onload = function ()
    {
        var bar = new RGraph.Bar({
            id: 'cvs',
            data: [[50,60,52],[65,30,50],[40,80,70],[115,100,92]],
            options: {
                gutterTop: 15,
                gutterLeft: 35,
                gutterRight: 15,
                backgroundGridVlines: false,
                backgroundGridBorder: false,
                colors: ['Gradient(white:#f11:#f11)', 'Gradient(white:#1cc:#1cc)', 'Gradient(white:#00f:#00f)'],
                tooltips: [
                   'Bob on Monday: 50 sales', 'Bob on Tuesday: 60 sales', 'Bob on Wednesday: 112 sales',
                   'Jamie on Monday: 65 sales', 'Jamie on Tuesday: 30 sales', 'Jamie on Wednesday: 50 sales',
                   'Cynthia on Monday: 40 sales', 'Cynthia on Tuesday: 80 sales', 'Cynthia on Wednesday: 70 sales',
                   'Peter on Monday: 115 sales', 'Peter on Tuesday: 100 sales', 'Peter on Wednesday: 92 sales'
                ],
                highlightStroke: 'rgba(0,0,0,0.1)',
                strokestyle: 'rgba(0,0,0,0)',
                shadow: true,
                shadowOffsetx: -2,
                shadowOffsety: -2,
                shadowBlur: 15,
                ymax: 150,
                noyaxis: true,
                ylabels: false,
                labels: ['Bob', 'Jamie', 'Cynthia', 'Peter'],
                labelsAbove: true,
                linewidth: 2,
                hmargin: 15,
                textAccessible: true
            }
        }).draw();



        var pie = new RGraph.Pie({
            id: 'cvs',
            data: [270,270,164],
            options: {
                exploded: [7,2,],
                labels: ['Mondays sales'],
                labelsSticks: [true],
                labelsSticksColor: 'black',
                centerx: 60,
                centery: 45,
                radius: 30,
                shadowBlur: 5,
                shadowOffsetx: 2,
                shadowOffsety: 2,
                shadowColor: '#aaa',
                colors: ['Gradient(white:#c11:#c11:#c11)', 'Gradient(white:#1cc:#1cc:#1cc)', 'Gradient(white:#11c:#11c:#11c)'],
                tooltips: ['Total Monday sales: 270', 'Total Tuesday sales: 270', 'Total Wednesday sales: 264'],
                tooltipsEvent: 'mousemove',
                strokestyle: 'rgba(0,0,0,0)',
                textAccessible: true
            }
        }).draw()



        $('#cvs').parent().addClass('animated expand');
        $('#cvs').addClass('animated expand');
    };
</script>

« Back