在高图中使两个系列指向相反的方向
Making two series point in opposite directions in highcharts
我有一个包含两个系列的柱形图,其中一个向下,另一个向上,如下所示:
然而,这两个系列都有正的 y 值,我无法更改,例如
blue = [1746181, 1884428, 2089758, 2222362, 2537431, 2507081, 2443179,
2664537, 3556505, 3680231, 3143062, 2721122, 2229181, 2227768,
2176300, 1329968, 836804, 354784, 90569, 28367, 3878];
grey = [1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2519874,
3360596, 3493473, 3050775, 2759560, 2304444, 2426504, 2568938, 1785638,
1447162, 1005011, 330870, 130632, 21208];
使用highcharts选项,是否可以得到这样的图表?我用于屏幕截图的示例是 this jsFiddle if it's useful to anyone, however it has a series with negative values which is not an option for me. Instead my data is more like this fiddle
我会尝试使用两个单独的 yAxes:http://jsfiddle.net/zares7x9/2/,其中之一是 reversed
:
yAxis: [{
title: {
text: null
},
top: '5%',
height: '45%',
labels: {
formatter: function () {
return (Math.abs(this.value) / 1000000) + 'M';
}
},
min: 0,
max: 4000000
}, {
title: {
text: null
},
labels: {
formatter: function () {
return (Math.abs(this.value) / 1000000) + 'M';
}
},
offset: 0,
showFirstLabel: false, // hide 0-value
reversed: true, //reverse
top: '50%',
height: '45%',
min: 0,
max: 4000000
}],
设置 top
和 height
允许您像一个轴一样渲染轴。请注意,您需要为其中一个系列设置 yAxis: 1
,以告知 Highcharts 哪个系列属于哪个轴。
我有一个包含两个系列的柱形图,其中一个向下,另一个向上,如下所示:
然而,这两个系列都有正的 y 值,我无法更改,例如
blue = [1746181, 1884428, 2089758, 2222362, 2537431, 2507081, 2443179,
2664537, 3556505, 3680231, 3143062, 2721122, 2229181, 2227768,
2176300, 1329968, 836804, 354784, 90569, 28367, 3878];
grey = [1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2519874,
3360596, 3493473, 3050775, 2759560, 2304444, 2426504, 2568938, 1785638,
1447162, 1005011, 330870, 130632, 21208];
使用highcharts选项,是否可以得到这样的图表?我用于屏幕截图的示例是 this jsFiddle if it's useful to anyone, however it has a series with negative values which is not an option for me. Instead my data is more like this fiddle
我会尝试使用两个单独的 yAxes:http://jsfiddle.net/zares7x9/2/,其中之一是 reversed
:
yAxis: [{
title: {
text: null
},
top: '5%',
height: '45%',
labels: {
formatter: function () {
return (Math.abs(this.value) / 1000000) + 'M';
}
},
min: 0,
max: 4000000
}, {
title: {
text: null
},
labels: {
formatter: function () {
return (Math.abs(this.value) / 1000000) + 'M';
}
},
offset: 0,
showFirstLabel: false, // hide 0-value
reversed: true, //reverse
top: '50%',
height: '45%',
min: 0,
max: 4000000
}],
设置 top
和 height
允许您像一个轴一样渲染轴。请注意,您需要为其中一个系列设置 yAxis: 1
,以告知 Highcharts 哪个系列属于哪个轴。