HighCharts:3D饼图未显示

时间:2016-10-04 03:27:27

标签: javascript highcharts highstock

以下是我的代码:

exec_dashboard_load_chart('exec_dashboard_gender_chart',response);

/**
 * A function that loads a chart.
 */
function exec_dashboard_load_chart(id , data){      
    var myChart = Highcharts.chart(id, {
        chart: {
            type: 'pie',
            options3d: {
               enabled: true,
               alpha: 45,
               beta: 0
            }
        },           
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                depth: 35,
                dataLabels: {
                    enabled: true,
                    format: '{point.name}'
                }
            }
        },
        series: data
    });
}

数据变量包含以下值:

enter image description here

这是我的fiddle

为什么我的3D图表不显示?我没有发现任何错误。我认为我的数据有问题。有人能指出我,我在哪里错过了吗?

1 个答案:

答案 0 :(得分:1)

查看此Working Fiddle

function exec_dashboard_load_chart(id , data){      
var myChart = Highcharts.chart(id, {
    chart: {
        type: 'pie',
        options3d: {
           enabled: true,
           alpha: 45,
           beta: 0
        }
    },           
    tooltip: {
        pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
    },
    plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            depth: 35,
            dataLabels: {
                enabled: true,
                format: '{point.name}'
            }
        }
    },
    series: [{
        type: 'pie',
        data: data.data
    }]
});
}