Highcharts 4.1.9+
4.1.9以降、軸の表示/非表示に使用できるオプションAxis.visibleがあります。デモ:http: //jsfiddle.net/3sembmfo/36/
Highchartsの古いバージョン
これはHighcharts3.0の新機能であり、軸をリアルタイムで更新できます。chart.yAxis[0].update(object)
オブジェクトはチャートの作成と同じオプションを使用します。例えば:
chart.yAxis[0].update({
labels: {
enabled: false
},
title: {
text: null
}
});
そしてjsFiddle: http: //jsfiddle.net/39xBU/2/
編集:
axis.hide()
以下のスニペットを使用して、とを呼び出すだけで軸を表示/非表示にしaxis.show()
ます。ライブデモ: http: //jsfiddle.net/39xBU/183/
(function (HC) {
var UNDEFINED;
HC.wrap(HC.Axis.prototype, 'render', function (p) {
if (typeof this.visible === 'undefined') {
this.visible = true;
}
if(this.visible) {
this.min = this.prevMin || this.min;
this.max = this.prevMax || this.max;
} else {
this.prevMin = this.min;
this.prevMax = this.max;
this.min = UNDEFINED;
this.max = UNDEFINED;
}
this.hasData = this.visible;
p.call(this);
});
HC.Axis.prototype.hide = function () {
this.visible = false;
this.render();
HC.each(this.plotLinesAndBands, function (plotLine) {
plotLine.render();
});
};
HC.Axis.prototype.show = function () {
this.visible = true;
this.render();
HC.each(this.plotLinesAndBands, function (plotLine) {
plotLine.render();
});
};
})(Highcharts);