2014-02-24 153 views
1

我遵循給出的例子,但每當我添加一個新的數據標籤,它永遠不會顯示爲一個切片。現在我添加了所有我想要顯示的值和數據,但瀏覽器上沒有顯示任何值。HighCharts沒有顯示任何東西

有人可以推薦任何東西嗎?

http://jsfiddle.net/LLExL/2466/

<!DOCTYPE HTML> 
<html> 
    <head> 
     <script type="text/javascript"> 
$(function() { 

     // Radialize the colors 
     Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function(color) { 
      return { 
       radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 }, 
       stops: [ 
        [0, color], 
        [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken 
       ] 
      }; 
     }); 

     // Build the chart 
     $('#container').highcharts({ 
      chart: { 
       plotBackgroundColor: null, 
       plotBorderWidth: null, 
       plotShadow: false 
      }, 
      title: { 
       text: 'Risk Mitigation' 
      }, 
      tooltip: { 
       pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' 
      }, 
      plotOptions: { 
       pie: { 
        allowPointSelect: true, 
        cursor: 'pointer', 
        dataLabels: { 
         enabled: true, 
         color: '#000000', 
         connectorColor: '#000000', 
         formatter: function() { 
          return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %'; 
         } 
        } 
       } 
      }, 
      series: [{ 
       type: 'pie', 
       name: 'Industry Distribution', 
       data: [ 
        ['Retail', 8.8], 
        ['Construction',  8.4], 
        { 
         name: 'Technology', 
         y: 9.7, 
         sliced: true, 
         selected: true 
        }, 
        ['Finance', 8.4], 
        ['Automotive', 8.3], 
        ['Restaurant', 8.3] 
        ['Energy', 7.8] 
        ['Medical', 7.0] 
        ['Marketing', 7.0] 
        ['Manufacturing', 6.9] 
        ['Food Distribution', 6.5] 
        ['Gym/Salons', 4.6] 
        ['Home Services', 4.4] 
        ['Travel', 2.5] 
        ['Other Industries', 1.4] 
       ] 
      }] 
     }); 
    }); 


     </script> 
    </head> 
    <body> 
<script src="../../js/highcharts.js"></script> 
<script src="../../js/modules/exporting.js"></script> 

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> 

    </body> 
</html> 
+0

沒有顯示出來呢?或者只是新的數據不顯示? –

+0

什麼都沒有......甚至沒有錯誤信息 – JsEveryDay

+0

創建一個複製問題的jsfiddle,人們將更願意幫助你。 –

回答

0

在開始的時候我建議熟悉控制檯錯誤(開發人員工具),那麼你西港島線發現你的語法不正確。您在序列 - >數據對象的行尾錯過了逗號。正確的形式

series: [{ 
      type: 'pie', 
      name: 'Industry Distribution', 
      data: [ 
       ['Retail', 8.8], 
       ['Construction',  8.4], 
       { 
        name: 'Technology', 
        y: 9.7, 
        sliced: true, 
        selected: true 
       }, 
       ['Finance', 8.4], 
       ['Automotive', 8.3], 
       ['Restaurant', 8.3], 
       ['Energy', 7.8], 
       ['Medical', 7.0], 
       ['Marketing', 7.0], 
       ['Manufacturing', 6.9], 
       ['Food Distribution', 6.5], 
       ['Gym/Salons', 4.6], 
       ['Home Services', 4.4], 
       ['Travel', 2.5], 
       ['Other Industries', 1.4] 
      ] 
     }] 

http://jsfiddle.net/LLExL/2468/