我目前有一个Highcharts图表,它有几个选项卡,允许用户在图形/图表上显示各种数据。我动态地为每一个数据点添加级数。
然而,我想为yAxis
的两个数据点设置min
和max
(而不是Highcharts只是自动确定min
和max
),以便在比较图上的数据时,它们彼此对齐。然而,我似乎找不到一种方法来为添加的系列设置yAxis
的min
和max
。
下面是我当前的内容:
window["chart"].addAxis({
id: 'Data',
title: {
text: 'Graph',
enabled: true
},
lineWidth: 0,
lineColor: '#000000'
});
window["chart"].addSeries({
data: groupingData,
name: 'Graph',
type: 'line',
color: '#000000',
yAxis: 'Data'
});
在动态添加此系列时,我如何强制min
和max
用于yAxis
?
您可以使用setExtrimes():
https://api.highcharts.com/highcharts/xAxis.events.setExtremeshttps://api.highcharts.com/highcharts/yAxis.events.setExtremes
chart.yAxis[0].setExtremes();
如果有人在寻找答案,我发现当addAxis被调用时,您可以设置min和max:
window["chart"].addAxis({
id: 'Data',
title: {
text: 'Graph',
enabled: true
},
lineWidth: 0,
lineColor: '#000000',
min: minNumber,
max: maxNumber
)}