Highcharts series.remove(false)不更新yAxis.datamax
我有多个y轴的海图。每个y轴都有多个基于测量单位的系列。例如,如果我们有3个测量单位为W的系列,它们将与相同的y轴相关联 用户可以选择在单击按钮时删除系列。系列按以下方式删除:Highcharts series.remove(false)不更新yAxis.datamax,highcharts,Highcharts,我有多个y轴的海图。每个y轴都有多个基于测量单位的系列。例如,如果我们有3个测量单位为W的系列,它们将与相同的y轴相关联 用户可以选择在单击按钮时删除系列。系列按以下方式删除: chart.series[channelIndex].remove(false); // If there are no data in the series and if no limit was previously set we update the limits to (0, 10) if (
chart.series[channelIndex].remove(false);
// If there are no data in the series and if no limit was previously set we update the limits to (0, 10)
if (yAxis.dataMax == null && limits.max == null) {
limits.max = 10;
}
yAxis.update({
min: limits.min,
max: limits.max
}, false);
删除序列后,我们更新y轴限制,如下所示。
如果轴具有无值序列,则Y轴的限制将设置为0、10。我通过以下方式添加默认限制:
chart.series[channelIndex].remove(false);
// If there are no data in the series and if no limit was previously set we update the limits to (0, 10)
if (yAxis.dataMax == null && limits.max == null) {
limits.max = 10;
}
yAxis.update({
min: limits.min,
max: limits.max
}, false);
问题是,删除序列后,yAxis.datamax不会更新。因此,即使yAxis没有序列,在删除序列之前,dataMax和dataMin仍然具有相同的值
我不明白为什么删除一个系列后y dataMin和dataMax没有更新。因此,任何关于为什么会出现这种行为的建议都是非常有用的。这是由于禁用重画造成的:
chart.series[channelIndex].remove(false);
如果您要替换falseredraw或只是删除false,它将正常工作。图表的重画将重新计算datamin和datamax。问题是我有很多数据要处理,如果将重画设置为true,性能将非常慢。我没有其他方法可以强制更新dataMin和dataMax吗?与其信任dataMin/dataMax,不如自己计算yAxis的min和max。