2016-10-04 152 views
0

下面是我的代碼:HighCharts:三維餅圖顯示不

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

爲什麼我的三維圖表不顯示?我沒有發現任何錯誤。我認爲我的數據有問題。有人能指出我在哪裏,我錯過了什麼?

回答

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

你能解釋它爲什麼那樣做? – Qerjiuthn

+0

您在提供數據時犯了一個錯誤。 – cheralathan