LoginSignup
0
0

More than 1 year has passed since last update.

Hightchartsのシリーズ/seriesの表示on/off

Last updated at Posted at 2021-08-10

やりたいこと

Highchartsを使っていて、シリーズ名部分をクリックすると、そのシリーズの表示on/offが出来てとっても便利だが、シリーズ数が多いと、その中の1つだけを見たい!という時にクリック数が増えて面倒。

https://www.highcharts.com/demo/line-basic より
image.png

一括でシリーズの表示on/off する

See the Pen Basic line by annnews (@annnews) on CodePen.

Highchartのインスタンスから、seriesに対してsetVisible(true|false)すればOK.

// シリーズのi番目を消す
chart.series[i].setVisible(false,true);

二番目のパラメータは、redrawするかしないか。

失敗例

chart.series[i].visible = false;

これだと、内部データでは非表示になっているが、表示が更新されない。chart.redraw()してもダメでした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0