高档更改范围选择器更改的刻度间隔 [英] Highstock Change tick interval on range selector change
问题描述
我无法在以下Jsfiddle中更新tickinterval: https://jsfiddle.net /rarwarrar/5xgoqjst/4/
I am unable to get the tickinterval to update in the following Jsfiddle: https://jsfiddle.net/rarwarrar/5xgoqjst/4/
当前此:
xAxis: {
events: {
setExtremes: function(e) {
if (e.rangeSelectorButton.text === "2Hour") {
$('#chart').highcharts().xAxis[0].tickInterval= 2700000 //45 min
$('#chart').highcharts().redraw()
}
}
}
},
不起作用.
例如,单击"2hour"后是否可以将刻度间隔设置为每45分钟一次?
For instance can the tick interval be set to every 45 minutes once '2hour' is clicked?
推荐答案
设置极限后,可以使用tickPositioner函数更改刻度位置.您可以使用Axis.update()更新此轴的tickPositions:
You can use tickPositioner function for changing your tick positions after you set your extremes. You can use Axis.update() for updating tickPositions of this axis:
setExtremes: function(e) {
if (e.rangeSelectorButton.text === "2Hour") {
this.update({
tickPositioner: function() {
var positions = [],
info = this.tickPositions.info;
for (var x = this.dataMin; x <= this.dataMax; x += 45 * 60 * 1000) {
positions.push(x);
};
positions.info = info;
return positions;
}
}, false)
}
}
在这里您可以看到一个示例,它如何工作: https://jsfiddle.net/5xgoqjst/5/
Here you can see an example how it can work: https://jsfiddle.net/5xgoqjst/5/
您还应该能够在不同范围内更改tickPositions.
You should be able to change your tickPositions on different ranges as well.
最诚挚的问候.
这篇关于高档更改范围选择器更改的刻度间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!