簡體   English   中英

編輯甜甜圈海圖

[英]Edit Donut Highchart

需要幫助刪除圖表灰色部分中從圖表中出來的灰色線。

http://jsfiddle.net/Y2e5p/

// Build the chart
$('#' + div_id).highcharts({
    chart: {
        plotBackgroundColor: null,
        plotBorderWidth: null,
        plotShadow: false,
        type: 'pie'
    },
    title: {
        text: title
    },
    tooltip: {
        enabled: false
    },
    plotOptions: {
        pie: {
            allowPointSelect: false,
            cursor: 'pointer'
        }
    },
    series: [{
        type: 'pie',
        name: title,
        size: '60%',
        innerSize: '40%',
        data: [{
            y: number,
            name: title,
            color: color,
            dataLabels: {
                enabled: true,
                color: '#000000',
                inside: true,
                formatter: function () {
                    return Math.floor(Number(this.percentage)) + ' %';
                }
            }
        }, {
            y: (100 - number),
            name: " ",
            color: '#AAAAAA',
            dataLabels: {
                enabled: true
            }
        }]
    }]
});

您可以為點設置數據標簽,並在格式化程序中識別是否應該設置數據標簽

http://jsfiddle.net/Y2e5p/2/

plotOptions: {
        pie: {
            allowPointSelect: false,
            cursor: 'pointer',
            dataLabels: {
                enabled:true,
                formatter: function () {
                    if(this.point.dataLabels.enabled)
                        return Math.floor(Number(this.percentage)) + ' %';
                    else
                        return null;
                }
            }
        }
    },

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM