简体   繁体   English

删除饼图轮廓文本

[英]removing pie chart outline text

I have placed a pie chart download from high charts but I have some issues I wanted to remove the text coming outlined of the pie chart can any one help me out and let me know how is this possible 我从较高的图表中下载了一个饼图下载,但是我遇到了一些问题,我想删除饼图中概述的文字,任何人都可以帮助我,让我知道这怎么可能

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
                    }
                }]
            }
        }]
    }
    });

I am unable to figure out how do I remove the text that is showing in the outlined area the text is visible out area of the chart can anyone help me out 我无法弄清楚如何删除在大纲区域中显示的文本,该文本在图表的可见区域外,有人可以帮助我吗 在此处输入图片说明

You have placed dataLabels property under plotOptions but it should be under pie object. 您已经将dataLabels属性放置在plotOptions下,但是它应该在pie对象下。 Your code 您的密码

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

Place dataLabels under pie of plotOptions, Sample code below: 将dataLabels放置在plotOptions的下面,下面的示例代码:

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

jsFiddle link for reference. jsFiddle链接以供参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM