我可以在初始选项对象中设置这些值,一切正常。例如,如果我稍后使用 chart.options.yAxis.tickInterval 更改选项,在重绘 yAxis 时它们似乎会被忽略。
// Global variables
var markInterval = undefined;
var minInterval = 0;
var maxInterval = undefined;
chart = new Highcharts.Chart({
// ...
yAxis: {
title: {
text: 'Mark'
},
labels: {
formatter: function() {
// html formatting
},
useHTML: true
},
tickInterval: markInterval,
min: minInterval,
max: maxInterval
},
plotOptions: {
series: {
events: {
legendItemClick: function(event) {
// setTickIntervals(); Change the global values markInterval, minInterval and maxInterval
chart.options.yAxis.tickInterval = markInterval;
chart.options.yAxis.min = minInterval;
chart.options.yAxis.max = maxInterval;
chart.redraw();
}
}
}
}
});