hightchart的3d餅狀圖圖例顯示問題記錄

友人A發表於2021-06-04

3d餅狀圖不顯示圖例,需要在plotOptions.pie.showInLegend設定為true

var chart = Highcharts.chart('container', {
    chart: {
        type: 'pie',
        options3d: {
            enabled: true,
            alpha: 45,
            beta: 0
        }
    },
    title: {
        text: ''
    },
    legend:{
        align: 'left',
        verticalAlign:'top',
        x: 0,
        y: 100
    },
    tooltip: {
        pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
    },
    plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            showInLegend: true,
            depth: 35,
            dataLabels: {
                enabled: true,
                format: '{point.name}'
            }
        }
    },
    series: [{
        type: 'pie',
        name: '瀏覽器佔比',
        data: [
            ['Firefox',   45.0],
            ['IE',       26.8],
            ['Safari',    8.5],
            ['Opera',     6.2],
            ['Others',   0.7]
        ]
    }]
});

相關文章