Reputation: 3882
I'm using highstock and want to prevent the user from selecting more than 1 day using the navigator, I want the navigator to be visible and to be able to use its scrollbar.
so basically if the user drags one of the handles then the other handle will move with it but never get close or further away.
Alternatively it would be ok to disable the handles so the user couldn't drag them at all but the summary graph that is part of the navigator must still be visible.
Does anyone know how to achieve this?
Upvotes: 0
Views: 590
Reputation: 37578
You can catch afterSetExtremes() function http://api.highcharts.com/highstock#xAxis.events.afterSetExtremes and chack if range is bigger than should be (set in external variable). Then if is bigger, you can call setExtremes() function which allows to define new range.
afterSetExtremes: function(e) {
var max = this.max,
min = this.min;
if(max-min > maxRange)
{
min = max - maxRange;
var x = this;
setTimeout(function(){
x.setExtremes(min,max); //chart xAxis
}, 1);
}
}
Upvotes: 1