我有一个场景,我正在绘制一个堆积柱形图,目前卡在一个点,我需要以特定顺序对系列进行排序,以防同一天有多个数据点。问题是,每天的系列顺序可能不同 - 我有下面的代码和示例 -
Highcharts.chart('container', {
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: -30,
verticalAlign: 'top',
y: 25,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.background2)
|| 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}<br/>Total:
{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: 'Mary',
data: [2, 2, 3, 2, 1]
}, {
name: 'Kevin',
data: [3, 4, 4, 2, 5]
}]
});
JSFiddle:http: //jsfiddle.net/arj_ary/4kz7rdpn/2/
要求:在上面的 JSFiddle 中,对于每个类别,我希望最低的数据点显示在顶部。所以对于苹果,我希望玛丽在顶部,因为它的值为 2。橙子和梨也是如此。
这可以实现吗?任何帮助表示赞赏。