解决HighCharts饼图中如果所占百分比为0的时候,不显示边线及0%的方法

<div class="piecleft" id="chart" style="height:350px; width: 350px;">
</div>
<script type="text/javascript" charset="utf-8">
var chart;
$(document).ready(function() {
   chart = new Highcharts.Chart({
      chart: {
         renderTo: 'chart'
      },
      title: {
         text: '版本分布分析'
      },
      plotArea: {
         shadow: null,
         borderWidth: null,
         backgroundColor: null
      },
      tooltip: {
         formatter: function() {
            return '<b>'+ this.point.name +'</b>: '+ Highcharts.numberFormat(this.percentage, 1) +'% ('+
                         Highcharts.numberFormat(this.y, 0, ',') +' 个)';
         }
      },
      plotOptions: {
         pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
               enabled: true,
               formatter: function() {
                   if (this.percentage > 0)
                       return '<b>' + this.point.name + '</b>: ' + this.percentage + ' %'; //这里进行判断(看这里)
               },
               color: 'white',
               style: {
                  font: '13px Trebuchet MS, Verdana, sans-serif'
               }
            }
         }
      },
      legend: {
         backgroundColor: '#FFFFFF',
         x: 0,
         y: -30
      },
      credits: {
          enabled: false
      },
       series: [{
         type: 'pie',
         name: 'Browser share',
         data: [
            ['1.1',3617],
            ['1.2.1',3436],
            ['1.0',416],
            ['1.3',2],
            ['1.2',1],
            ['新增对比',5000] 
         ]
      }]
   });
});
</script> 

解决HighCharts饼图中如果所占百分比为0的时候,不显示边线及0%的方法解决HighCharts饼图中如果所占百分比为0的时候,不显示边线及0%的方法

                                                   对比前                                                                                                                                       对比后


上一篇:如何利用云计算最大限度地改善数据存储


下一篇:德国市占率第一的科沃斯携最新扫地机器人亮相IFA展