2013-11-01 69 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。现在我希望我的图表能够显示每辆四轮车作为一个堆叠的列,显示其所有数据(福特,马鲁蒂,本田,宝马)作为其堆栈,同样适用于二轮车。任何帮助将不胜感激。

回答

相关问题