2017-06-02 63 views
1

我已经放置从高图表饼图下载,但我有一些问题,我想删除文本来概述的饼图可以任何一个帮助我,让我知道这是如何可能的删除饼图轮廓文本

var colors = Highcharts.getOptions().colors, 
    categories = ['MSIE', 'Firefox', 'Chrome', 'Safari', 'Opera'], 
    data = [{ 
     //y: 56.33, 
     color: colors[0], 
     drilldown: { 
      name: 'MSIE versions', 
      categories: ['General Public (Local)'], 
      data: [<?php echo $company_details[0]['individual']; ?>], 
      color: colors[0] 
     } 
    }, { 
     //y: 10.38, 
     color: colors[1], 
     drilldown: { 
      name: 'Firefox versions', 
      categories: ['Foreign (Ind. & Inst.)'], 
      data: [<?php echo $company_details[0]['foreign']; ?>], 
      color: colors[1] 
     } 
    }, { 
     //y: 24.03, 
     color: colors[2], 
     drilldown: { 
      name: 'Chrome versions', 
      categories: ['Institutional'], 
      data: [<?php echo $company_details[0]['institutions']; ?>], 
      color: colors[2] 
     } 
    }, { 
     //y: 4.77, 
     color: colors[3], 
     drilldown: { 
      name: 'Safari versions', 
      categories: ['Directors/Spouses'], 
      data: [<?php echo $sum_all_details; ?>], 
      color: colors[3] 
     } 
    }, { 
     // y: 0.2, 
     color: colors[5], 
     drilldown: { 
      name: 'Proprietary or Undetectable', 
      categories: [], 
      data: [], 
      color: colors[5] 
     } 
    }], 
    browserData = [], 
    versionsData = [], 
    i, 
    j, 
    dataLen = data.length, 
    drillDataLen, 
    brightness; 

// Build the data arrays 
for (i = 0; i < dataLen; i += 1) { 
// add browser data 
browserData.push({ 
    name: categories[i], 
    y: data[i].y, 
    color: data[i].color 
}); 

// add version data 
drillDataLen = data[i].drilldown.data.length; 
for (j = 0; j < drillDataLen; j += 1) { 
    brightness = 0.2 - (j/drillDataLen)/5; 
    versionsData.push({ 
     name: data[i].drilldown.categories[j], 
     y: data[i].drilldown.data[j], 
     color: Highcharts.Color(data[i].color).brighten(brightness).get() 
    }); 
} 
} 

// Create the chart 
Highcharts.chart('container', { 
    chart: { 
     type: 'pie' 
    }, 
    yAxis: { 
     title: { 
      text: 'Total percent market share' 
     } 
    }, 
    plotOptions: { 
     pie: { 
      shadow: false, 
      center: ['50%', '50%'] 
     }, 
     dataLabels: { 
      enabled: false 
     } 
    }, 
    tooltip: { 
     valueSuffix: '%' 
    }, 
    series: [{ 
     name: 'Browsers', 
     data: browserData, 
     size: '30%', 
     dataLabels: { 
      formatter: function() { 
       return this.y > 5 ? this.point.name : null; 
      }, 
      color: '#ffffff', 
      distance: -30 
     } 
    }, { 
     name: 'Versions', 
     data: versionsData, 
     size: '90%', 
     innerSize: '40%', 
     dataLabels: { 
      formatter: function() { 
       // display only if larger than 1 
       return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + 
        this.y + '%' : null; 
      } 
     }, 
     id: 'versions' 
    }], 
    responsive: { 
     rules: [{ 
      condition: { 
       maxWidth: 250 
      }, 
      chartOptions: { 
       series: [{ 
        id: 'versions', 
        dataLabels: { 
         enabled: false 
        } 
       }] 
      } 
     }] 
    } 
    }); 

我无法弄清楚如何删除是在轮廓区域显示文本的文本是图表可见出地区的人可以帮助我 enter image description here

+0

我的回答对你有帮助吗?如果是,请接受答案。 – ali

回答

4

你已经把dataLabels财产在plotOptions下,但它应该在饼图对象下。 您的代码

plotOptions: { 
    pie: { 
     shadow: false, 
     center: ['50%', '50%'] 
    }, 
    dataLabels: { 
     enabled: false 
    } 
} 

下plotOptions的馅饼广场dataLabels,下面的示例代码:

plotOptions: { 
    pie: { 
     shadow: false, 
     center: ['50%', '50%'] 
     dataLabels: { 
      enabled: false 
     } 
    } 
} 

jsFiddle链接以供参考。