Nik*_*kos 4 highcharts highstock
我试图在下面的xAxis事件处理程序中设置Extremes,我得到Uncaught TypeError.如何在xAxis事件处理程序中设置Extremes?
xAxis: {
events: {
setExtremes: function (e) {
if (e.trigger === "navigator") {
forceRebuildSeries(); //Get all data points
// Set Extremes (redisplay with new data points)
this.chart.xAxis[0].setExtremes(e.min, e.max); //Uncaught TypeError: Property 'setExtremes' of object #<Object> is not a function
}
}
}
},
Run Code Online (Sandbox Code Playgroud)
我将不胜感激任何帮助或解决方法.谢谢.
小智 5
我知道这有点晚了,只是想把我的答案添加到未来的访客中.
Highchart不允许从setExtremes事件处理程序内部调用setExtremes,以避免无限循环.这就是你得到错误的原因.
但是,您可以插入超时以解决此保护问题:
xAxis: {
events: {
setExtremes: function (e) {
if (e.trigger === "navigator") {
var c = this;
setTimeout(function() {
forceRebuildSeries(); //Get all data points
// Set Extremes (redisplay with new data points)
c.chart.xAxis[0].setExtremes(e.min, e.max);
}, 1);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7928 次 |
| 最近记录: |