2015-10-06 66 views
2

我要求在數據集中顯示餅圖以及列/欄。如果是餅圖,可以顯示圖例中的每個數據點。柱形圖中也有可能嗎?下面是我曾嘗試:高圖中柱狀圖中每個點的圖例

Fiddle of my code

$('#container').highcharts({ 
    chart: { 
     type: 'column' 
    }, 
    xAxis:{categories:["Jan","Feb","Mar"]}, 
    plotOptions: { 

     series: { 
      allowPointSelect: true 
     } 
    }, 
    series: [{data:[{name:'Jan',y:20},{name:'Feb',y:24},{name:'Mar',y:35}],showInLegend:true}] 
      }); 

我想顯示「一月」,「二月」和傳說中的「三月」。這有可能實現嗎?

回答

1

更新 在傳說的類別名稱,見this fiddle

如果你想顯示在傳說中值,你必須包括一個插件看到this link 及其working fiddle with value in legends here

如果你想在需要使用數據列的列上顯示值,如下所示代碼

plotOptions: { 

     series: { 
      allowPointSelect: true, 
       dataLabels: { 
      enabled: true, 
      color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'black', //choose your own color whatever you want 
      style: { 
       textShadow: '0 0 3px black' //if you need text shadow 
      } 
     } 
     } 
    } 

working fiddle here

+0

這不是我要找的。實際上,在我發佈的鏈接中,我希望圖例中的'Jan','Feb'和'Mar'代替系列1.如果圖表類型爲「餅圖」,則所有點都顯示在圖例中。我想在'列'圖中也有相同的行爲。 – Viji

+0

您是否看到過我在回答開始時分享的鏈接? –

+0

@Viji明白了,我想你需要像這樣的小提琴http://jsfiddle.net/Nishith/md2zk/110/檢查並回復。它在傳說中有類別名稱 –