Ahmad Hajou
Ahmad Hajou

Reputation: 1319

Edit Donut Highchart

Need help removing that grey line coming out of the chart in the grey part of the chart.

http://jsfiddle.net/Y2e5p/

// Build the chart
$('#' + div_id).highcharts({
    chart: {
        plotBackgroundColor: null,
        plotBorderWidth: null,
        plotShadow: false,
        type: 'pie'
    },
    title: {
        text: title
    },
    tooltip: {
        enabled: false
    },
    plotOptions: {
        pie: {
            allowPointSelect: false,
            cursor: 'pointer'
        }
    },
    series: [{
        type: 'pie',
        name: title,
        size: '60%',
        innerSize: '40%',
        data: [{
            y: number,
            name: title,
            color: color,
            dataLabels: {
                enabled: true,
                color: '#000000',
                inside: true,
                formatter: function () {
                    return Math.floor(Number(this.percentage)) + ' %';
                }
            }
        }, {
            y: (100 - number),
            name: " ",
            color: '#AAAAAA',
            dataLabels: {
                enabled: true
            }
        }]
    }]
});

Upvotes: 1

Views: 283

Answers (1)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

You can set datalabels for point and in formatter recognise if datalabels should be or not

http://jsfiddle.net/Y2e5p/2/

plotOptions: {
        pie: {
            allowPointSelect: false,
            cursor: 'pointer',
            dataLabels: {
                enabled:true,
                formatter: function () {
                    if(this.point.dataLabels.enabled)
                        return Math.floor(Number(this.percentage)) + ' %';
                    else
                        return null;
                }
            }
        }
    },

Upvotes: 2

Related Questions