admin管理员组文章数量:1245088
I would like to link a pair of series in highcharts so that clicking either one in the legend turns both in the pair on/off.
For example, in this fiddle, if I click 1A
in the legend I would like it to also turn off 2A
but leave 1B
and 2B
unaffected. Clicking 2A
should also turn off 1A
, i.e. the link should work both ways.
Is there a way to achieve this?
I would like to link a pair of series in highcharts so that clicking either one in the legend turns both in the pair on/off.
For example, in this fiddle, if I click 1A
in the legend I would like it to also turn off 2A
but leave 1B
and 2B
unaffected. Clicking 2A
should also turn off 1A
, i.e. the link should work both ways.
Is there a way to achieve this?
Share Improve this question asked Jul 9, 2013 at 9:41 harrygharryg 24.1k47 gold badges134 silver badges208 bronze badges2 Answers
Reset to default 12You can also use linkedTo
options from Highcharts, see: http://jsfiddle/GCqsf/4/
There is only one limit - linked series isn't displayed in legend, so probably it may not fit the best your example. Since Highcharts 3.0.7 you can set series.showInLegend = true
to display linked series in legend.
You'll have to handle the legendItemClick
event and specifically hide (and show) the "sister" series.
I have a running example in this jsFiddle.
Note that I'm using the links
variable as an easy way to get the "sister" series for a given series.
Also note that I've added an id
to each series so that chart.get()
returns the series when given its id.
本文标签: javascripthighcharts link series such that turn one off turns off the otherStack Overflow
版权声明:本文标题:javascript - highcharts link series such that turn one off turns off the other - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740177299a2236665.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论