我想在堆叠柱状图中表示两类数据。虽然我可以得到一个带有堆栈的专栏,其中显示了它的子类别data.Below,但我正在尝试编写代码
$(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]
}]
});
});我想要一个图表,可以完全满足以下提到的要求。如果我们有ford=25,Maruti=30,Honda=20,BMW=15和两轮车Bajaj=70,Yamaha=60,Honda=40,Suzuki=10等汽车的数据,我想展示每月四轮车(汽车)和两轮车(自行车和摩托车)的销售情况,例如10月份。现在我希望我的图表将每辆四轮车显示为一个堆叠列,显示其所有数据(福特,马鲁蒂,本田,宝马)作为堆栈,对于两轮车也是如此。任何帮助都将不胜感激。
发布于 2013-11-03 19:37:18
我的建议是熟悉分组插件,https://github.com/blacklabel/grouped_categories/似乎可以解决你的问题。请让我们知道它是否正确。
https://stackoverflow.com/questions/19724112
复制相似问题