Pie chart explode (using the click event)

This Pie chart is similar to the explode mousemove demo. But instead of using the mousemove event this uses the click event. As a result of using the click event instead of the mousemove event you will see far fewer peculiarities.

[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.common.effects.js"></script>
<script src="RGraph.pie.js"></script>
Put this where you want the chart to show up:
<canvas id="cvs" width="450" height="300">
    [No canvas support]
</canvas>
This is the code that generates the chart:
<script>
    // Create the Pie chart
    pie = new RGraph.Pie({
        id: 'cvs',
        data: [4,6,3,5,2,5,8],
        options: {
            labels: ['Monday', 'Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
            textColor: '#aaa',
            exploded: 5,
            radius: 100,
            linewidth: 1
        }
    }).on('click', function (e, shape)
    {
        if (!pie.get('exploded') || !pie.get('exploded')[shape['index']]) {
            pie.explodeSegment(shape['index'], 25);
        }
        
        e.stopPropagation();
    }).on('mousemove', function (e, shape)
    {
        e.target.style.cursor = 'pointer';
    }).draw()
    
    
    
    // Add the window click listener that resets the Pie chart
    window.onmousedown = function (e)
    {
        pie.set('exploded', 5);
        RGraph.redraw();
    }
</script>