2013-06-06 129 views
0

我的系列數據如下: -highcharts - 不顯示餅圖傳說

[{"name":"Calculated Profit","data":[{"y":90,"rowData":{"Salesperson":"Dr. Gary Barlow","EP":90.00000,"AP":390.00000,"CP":90.00000,"Retries":1}},{"y":90,"rowData":{"Salesperson":"Fr. G R Blue","EP":90.00000,"AP":390.00000,"CP":90.00000,"Retries":1}},{"y":3332.8908,"rowData":{"Salesperson":"Miss Lynsey A Carr","EP":3332.89080,"AP":9252.84214,"CP":3332.89080,"Retries":3}},{"y":157.5,"rowData":{"Salesperson":"Mr. G WALTON","EP":157.50000,"AP":472.50000,"CP":157.50000,"Retries":1}},{"y":90,"rowData":{"Salesperson":"Mr. Jason Orange","EP":90.00000,"AP":390.00000,"CP":90.00000,"Retries":1}},{"y":3746.35416,"rowData":{"Salesperson":"Mr. Joe Bloggs","EP":3746.35416,"AP":11239.06249,"CP":3746.35416,"Retries":1}},{"y":90,"rowData":{"Salesperson":"Prof. Howard Donald","EP":90.00000,"AP":390.00000,"CP":90.00000,"Retries":1}},{"y":90,"rowData":{"Salesperson":"Prof. T V Smith","EP":90.00000,"AP":390.00000,"CP":90.00000,"Retries":1}},{"y":90,"rowData":{"Salesperson":"RtHon. H Q Brown","EP":90.00000,"AP":390.00000,"CP":90.00000,"Retries":1}}]}] 

我的圖表plotOptions如下: -

plotOptions: { 

         pie: { 
          allowPointSelect: true, 
          cursor: 'pointer', 
          dataLabels: { 
           enabled: true 
         }, 
         tooltip: { 
          pointFormat: '{series.data.rowData.Salesperson}: <b>{point.percentage}%</b>', 
          percentageDecimals: 1 
         }, 
         showInLegend: true 

       } 

任何指針。作爲聯想顯示爲{系列.data.rowData.Salesperson}

回答

0

不幸的是,您需要使用tooltip.formatter,而不是pointFormat。 PointFormat是簡單的正則表達式,它只檢出點/序列後的第一個元素,並將其與點/序列對象的鍵進行比較。

0

爲了設置圖例標籤作爲銷售人員,你可以使用legend.labelFormatter回調函數在同一水平上的圖表,看到完整的link to fiddle

legend: { 
    labelFormatter: function() { 
     return this.rowData.Salesperson; 
    } 
    }, 
    tooltip: { 
    formatter: function() { 
     return '<b>' + this.point.rowData.Salesperson + '</b> ' + Highcharts.numberFormat(this.point.percentage, 1) +' %'; 
    }, 
    percentageDecimals: 1 
    }, 
    plotOptions: { 
    pie: { 
     allowPointSelect: true, 
     cursor: 'pointer', 
     dataLabels: { 
     enabled: true, 
     formatter: function() { 
      return this.point.rowData.Salesperson; 
     } 
     }, 
     showInLegend: true 
    } 
    }