Referenced Files Pie

by blowsie

HTML

<script src="http://www.highcharts.com/js/highcharts.js"></script>
<div id="container" style="height: 220px; margin:40px;"></div>

JavaScript

chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container',
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false
        },
        title: null,
        tooltip: {
            formatter: function() {
                return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
            }
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
                        return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
                    }
                }
            }
        },
        series: [{
            type: 'pie',
            data: [
     
                {
                    name: 'Linked',
                    y: 70,
                    sliced: true,
                    selected: true,
                    color: 'green'
                },
                            {
                    name: 'Awaiting',
                    y: 30,
                    sliced: false,
                    selected: false,
                    color: 'red'
                }
            ]
        }]
});

// the button action
$button = $('#button');
$button.click(function() {
    var series = chart.series[0];
    if (series.visible) {
        series.hide();
        $button.html('Show series');
    } else {
        series.show();
        $button.html('Hide series');
    }
});