Hightchartsのシリーズ/seriesの表示on/off
2116 ワード
やりたいこと
Highchartsを使っていて、シリーズ名部分をクリックすると、そのシリーズの表示on/offが出来てとっても便利だが、シリーズ数が多いと、その中の1つだけを見たい!という時にクリック数が増えて面倒。
https://www.highcharts.com/demo/line-basic より
一括でシリーズの表示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()してもダメでした。
Author And Source
この問題について(Hightchartsのシリーズ/seriesの表示on/off), 我々は、より多くの情報をここで見つけました https://qiita.com/annnews23/items/6680b580525c2ef9c5b6著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .