当我们设置y轴的最大值和最小值时,比例就固定了。如果我们只是想通过隐藏其他级数来看到单个级数,它怎么可能是动态的而不是固定的尺度呢?
yAxis: {min: 0, max: 100}
例如在下面的小提琴中,当我隐藏系列2时,是否可以动态地调整其余系列的比例
http://jsfiddle.net/H2pyC/38/谢谢
你可以自己滚动events.legendItemClick
:
plotOptions: {
series: {
shadow: true,
events: {
legendItemClick: function (event) {
var theChart = this.chart;
console.log(theChart);
theChart.yAxis[0].update({
max: null,
min: null
});
}
}
}
}
您要做的是将yAxis
的最小值和最大值设置为null
。这让highcharts决定动态的最小/最大值。你可能想让它跟踪on-load的min/max,这样当你重新启用所有系列时,它会将min/max设置为on-load时的值