我们有两个系列,他们的系列类型是'spline'和'column'。我展示它们是动态的,如果我们得到第一个系列类型'样条',列将阻止图形背面的样条系列。有没有'始终显示列的样条前端'的方法?这是样本:
series: [{
name: 'Temperature',
color: '#89A54E',
type: 'spline',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],
tooltip: {
valueSuffix: ' °C'
}
},{
name: 'Rainfall',
color: '#4572A7',
type: 'column',
yAxis: 1,
data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
tooltip: {
valueSuffix: ' mm'
}
}, ]
答案 0 :(得分:0)
只需Array.sort()
他们想要的方式:
series = series.sort(function (a, b) {
if (a.type > b.type) return 1;
if (a.type < b.type) return -1;
});
这只是一个简单的样本。您可以介绍自己的,更复杂的排序逻辑。
答案 1 :(得分:0)
您可以使用series index
来定义系列的顺序。