Highcharts Demo

author(s): Torstein Hønsi

by kzoon

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>

<div id="container" style="height: 400px; width: 500"></div>

JavaScript

$(function() {
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container',
            type: 'pie'
        },

        plotOptions: {
            pie: {
                point: {
                    events: {
                        legendItemClick: function() {
                            if (this.visible) {
                                this['y_old'] = this.y;
                                this.update(0);
                            }
                            else {
                                if (this.y_old != undefined) {
                                    this.update(this.y_old);
                                }
                            }
                          return true;
                        }
                    }
                },
                showInLegend: true
            }
        },

        series: [{
            data: [
                {
                name: 'Firefox',
                y: 44.2},
                ['IE7', 26.6],
                ['IE6', 20],
                ['Chrome', 3.1],
            {
                name: 'Other',
                y: 5.4,
                visible: false
            }
            ]}]
    });
});