Dhaval Patel
Dhaval Patel

Reputation: 7601

How to remove white space from pie chart in highchart.js?

Blue circle with whitespace at the top, circled in red.

I want to remove the white space circled in red above. I am using the code below in jsFiddle:

$(function () {

$('#container').highcharts({
    chart: {
        plotBackgroundColor: null,
        plotBorderWidth: null,
        plotShadow: false,borderRadius: 0,
                    borderWidth:0,
    },
    title: {
        text: 'Browser market shares at a specific website, 2010'
    },
     tooltip: false,
    plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
                enabled: true,
                color: '#000000',
                connectorColor: '#000000',
                format: '<b>{point.name}</b>: {point.percentage:.1f} %'
            }
        }
    },
    series: [{
        type: 'pie',
        name: 'Browser share',
         size: '115%',
         innerSize: '110%',
        data: [
            ['Firefox',   45.0]

        ]
    },{type: 'pie',
        name: 'Browser share',
         size: '100%',
                        innerSize: '98%',
        data: [
            ['Firefox',   45.0]

        ]}
]});
});

Fiddle: http://jsfiddle.net/jF22s/

Upvotes: 4

Views: 4372

Answers (3)

Mr.7
Mr.7

Reputation: 2713

borderColor: null will fix the issue

plotOptions: {
    pie: {
        borderColor: null,
    }
}

ref: http://jsfiddle.net/highcharts/NK5db/17/

Upvotes: 3

Sebastian Bochan
Sebastian Bochan

Reputation: 37588

Unfortunately it is known bug, reported here

Upvotes: 2

DhruvPathak
DhruvPathak

Reputation: 43265

use borderWidth :0 in plot options.

  pie: {
        allowPointSelect: true,
        cursor: 'pointer',

         borderWidth: 0, // This removes the border

Updated fiddle : http://jsfiddle.net/jF22s/5/

If that is not acceptable ( as it still has a very minute space ), add a border of same color to the chart, that would remove all space:

borderWidth: 1,
borderColor:'#2F7ED8',

fiddle : http://jsfiddle.net/jF22s/15/

Upvotes: 8

Related Questions