Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove the white border from HighCharts pie chart?

I am using High-charts to show pie charts, can any one tell me how can I remove this white border around the radius. My code is given below also the screen shot image of chart.

I have no lot of experience with high-charts if anyone know this please help me. The documentation is also very tough to read and understand

$(function () {
  
  $('#cashflow_graph').highcharts({
        chart: {
            type: 'pie',
			backgroundColor:'red',
        },
        title: {
            text: false
        },
        yAxis: {
            title: {
                text: false
            }
        },
        plotOptions: {
            pie: {
                dataLabels: {
                        enabled: false
                    },
                shadow: false,
                center: ['50%', '50%']
            },
			series: {
				states: {
					hover: {
						enabled: false,
						halo: {
							size: 0
						}
					}
				}
			},
			
        },
		 credits: {
            enabled: false
        },
        tooltip: {
			enabled: false,
            valueSuffix: '%'
        },
        series: [{
            name: 'Cash Flow',
            data: [
                {
                    name: 'Incoming',
                    y: 40,
                   
					color: '#87b22e'
                },
				{
                    name: 'Outgoing',
                    y: 30,
                    
					 color: 'black'
                },
				{
                    name: '',
                    y: 30,
					 color: 'white'
                }
                
            ],
            size: '80%',
            innerSize: '80%',
            dataLabels: {
				enabled: false,
                formatter: function () {
              
					return false;
                }
            }
        }]
    });
  
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.1.5/highcharts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.1.5/highcharts-more.src.js"></script>


<div id="cashflow_graph" style="height: 300px; width:100%;"></div>

enter image description here

like image 583
vikujangid Avatar asked May 06 '15 12:05

vikujangid


People also ask

How do I get rid of the white space around a pie chart?

Re: Removing white space between sections of pie chart The white space/line between the slices is the border, to remove it set borderWidth: 0. Alternatively, you can consider using the solid-gauge instead, that is far closer to your examples.

How do you add a border to a pie chart?

Click the chart to select it. In the Format sidebar, click the Chart tab. In the Chart Options section of the sidebar, select the Border checkbox.


1 Answers

You need to set the plotOptions.pie.borderWidth property to 0:

$(function() {
  $('#cashflow_graph').highcharts({
    chart: {
      type: 'pie',
      backgroundColor: 'red',
    },
    title: {
      text: false
    },
    yAxis: {
      title: {
        text: false
      }
    },
    plotOptions: {
      pie: {
        dataLabels: {
          enabled: false
        },
        shadow: false,
        center: ['50%', '50%'],
        borderWidth: 0 // < set this option
      },
      series: {
        states: {
          hover: {
            enabled: false,
            halo: {
              size: 0
            }
          }
        }
      },

    },
    credits: {
      enabled: false
    },
    tooltip: {
      enabled: false,
      valueSuffix: '%'
    },
    series: [{
      name: 'Cash Flow',
      data: [{
          name: 'Incoming',
          y: 40,

          color: '#87b22e'
        }, {
          name: 'Outgoing',
          y: 30,

          color: 'black'
        }, {
          name: '',
          y: 30,
          color: 'white'
        }

      ],
      size: '80%',
      innerSize: '80%',
      dataLabels: {
        enabled: false,
        formatter: function() {
          return false;
        }
      }
    }]
  });

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.1.5/highcharts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.1.5/highcharts-more.src.js"></script>

<div id="cashflow_graph" style="height: 300px; width:100%;"></div>
like image 147
Rory McCrossan Avatar answered Oct 05 '22 23:10

Rory McCrossan