2014-01-07 52 views
0

试图找出如何显示此highcharts与名称的数据类别(约翰,简,JOE)例如在不改变数据是如何供给Highcharts叠置条数据

$(function() 
{ 
    $('#container').highcharts({ 
     chart: { 
      type: 'bar' 
     }, 
     title: { 
      text: 'Stacked bar chart' 
     }, 
     xAxis: { 
      categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] 
     }, 
     yAxis: { 
      min: 0, 
      title: { 
       text: 'Total fruit consumption' 
      } 
     }, 
     legend: { 
      backgroundColor: '#FFFFFF', 
      reversed: true 
     }, 
     plotOptions: { 
      series: { 
       stacking: 'normal' 
      } 
     }, 
      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] 
     }] 
    }); 
});` 

http://jsfiddle.net/zAMCK/

基本上,我想一起提供数据类别。这可能吗?还要提供每人多种不同的水果,这可能是每个人独特的

回答

0

您可以为每个值比X类指标设置,演示:http://jsfiddle.net/zAMCK/1/

 series: [{ 
      name: 'John', 
      data: [[0, 2], [3, 5], [4, 1]] 
     }, { 
      name: 'Jane', 
      data: [[1, 3], [1, 5], [1, 3]] //not supported duplicate x-values 
     }, { 
      name: 'Joe', 
      data: [[0, 1], [2, 5], [4, 1]] 
     }]