如何从HighCharts饼图中删除白色边框?

时间:2015-05-06 12:52:59

标签: javascript jquery html highcharts

我使用高图来显示饼图,任何人都可以告诉我如何删除半径周围的白色边框。我的代码也在下面给出了图表的屏幕截图。

我对高级图表没有太多经验,如果有人知道,请帮助我。文档也很难阅读和理解



$(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>
&#13;
&#13;
&#13;

enter image description here

1 个答案:

答案 0 :(得分:13)

您需要将plotOptions.pie.borderWidth属性设置为0

&#13;
&#13;
$(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;
        }
      }
    }]
  });

});
&#13;
<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>
&#13;
&#13;
&#13;