2013-11-01 18 views
0

我想在堆積的柱形圖中表示兩類數據。雖然我能夠與堆棧顯示它的子類data.Below得到一列是我努力希望堆積的列高圖表示兩個colomn中的數據

$(function() { 
    $('#container').highcharts({ 
     chart: { 
      type: 'column' 
     }, 
     title: { 
      text: 'Stacked column chart' 
     }, 
     xAxis: { 
      categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] 
     }, 
     yAxis: { 
      min: 0, 
      title: { 
       text: 'Total fruit consumption' 
      }, 
      stackLabels: { 
       enabled: true, 
       style: { 
        fontWeight: 'bold', 
        color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' 
       } 
      } 
     }, 
     legend: { 
      align: 'right', 
      x: -70, 
      verticalAlign: 'top', 
      y: 20, 
      floating: true, 
      backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'white', 
      borderColor: '#CCC', 
      borderWidth: 1, 
      shadow: false 
     }, 
     tooltip: { 
      formatter: function() { 
       return '<b>'+ this.x +'</b><br/>'+ 
        this.series.name +': '+ this.y +'<br/>'+ 
        'Total: '+ this.point.stackTotal; 
      } 
     }, 
     plotOptions: { 
      column: { 
       stacking: 'normal', 
       dataLabels: { 
        enabled: true, 
        color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white' 
       } 
      } 
     }, 
     series: [{ 
      name: 'John', 
      data: [5, 3, 4, 7, 2] 
     }, { 
      name: 'Jane', 
      data: [2, 2, 3, 2, 1] 
     }, { 
      name: 'Joe', 
      data: [3, 4, 4, 2, 5] 
     }] 
    }); 
}); 

代碼我想圖表可以充分填寫以下提到的要求。例如,如果我們有汽車數據,例如= 25,馬魯蒂= 30,本田= 20,那麼我想每個月例如在十月份的月份中顯示明年購買四輪車(汽車)和二輪車(自行車和踏板車)寶馬= 15,二輪車Bajaj = 70,雅馬哈= 60,本田= 40,鈴木= 10。現在我希望我的圖表能夠顯示每輛四輪車作爲一個堆疊的列,顯示其所有數據(福特,馬魯蒂,本田,寶馬)作爲其堆棧,同樣適用於二輪車。任何幫助將不勝感激。

回答

相關問題