问题
I've searched through the API and there are lots of examples on disabling and styling both the scroll bar and the navigator. I want to keep both intact but disable the handlebars from being draggable. I tried playing with the styles on this fiddle:
http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/stock/navigator/handles/
navigator: {
handles: {
backgroundColor: 'yellow',
borderColor: 'red'
}
}
but only the backgroundColor and borderColor are accessible attributes according to the API.
回答1:
You can use setExtremes:
http://jsfiddle.net/B7vCR/3/
xAxis: {
minRange:6 * 30 * 24 * 3600 * 1000,
events: {
afterSetExtremes: function(e) {
var maxDistance = 10 * 30 * 24 * 3600 * 1000; //8 months time
var xaxis = this;
if ((e.max - e.min) > maxDistance) {
var min = e.max - maxDistance;
var max = e.max;
window.setTimeout(function() {
xaxis.setExtremes(min, max);
}, 1);
}
}
}
},
来源:https://stackoverflow.com/questions/15125572/disabling-handlebars-in-highstock-charts-navigator