Pie Datalabel distance2

by kzoon

HTML

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

<div id="container" style="min-width: 500px; height: 700px; margin: 0 auto"></div>

JavaScript

$(function() {
    var pieSize= 300;
    var innerSize=200;
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container'

            },
            title: {
                text: null
            },

            plotOptions: {
                pie: {
                    size: pieSize,
                    innerSize:innerSize,

                    dataLabels: {

                        //distance: -30, //longer datalabels drift outside their slice
                        //distance: -(pieSize / 6), //distance = 1/3 of radius
                       distance: -((pieSize-innerSize) / 4), //distance = 1/2 of donut width
                        color: 'black',
                        formatter: function() {
                            //Long label:
                            //return this.point.name + ' (' + this.percentage + '%)';
                            //Short label:
                            return this.percentage + '%';
                        }
                    }
                }
            },
            series: [{
                type: 'pie',
                name: 'Browser share',
                data: [
                    ['Firefox', 45.0],
                    ['IE', 26.8],
                    ['Chrome', 12.8],
                    ['Safari', 8.5],
                    ['Opera', 6.2],
                    ['Others', 0.7]

                    ]}]
        });
    });

});