不使用图例隐藏Highcharts系列 [英] Hiding a Highcharts series without using the legend

查看:85
本文介绍了不使用图例隐藏Highcharts系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够从按钮而不是图例中隐藏Highcharts系列(原因是我需要从一个按钮切换多个组:隐藏Highcharts和jQuery中的_groups_系列:如何获得可接受的性能?,并且出于该帖子中给出的原因,我不能使用 $(chart.series).each ) with jQuery。



以下所有表达式都没有任何影响(我的图表对象被命名为 chart

  Chart.series.get(1).hide(); 
chart.series .get(1).hide();
$(chart.series [1])。hide();
$(chart.series [1])。hide();
$(chart.series [1])。hide();
$(chart.series)[1]。hide();
$(chart.series)[1]。 hide();

有人可以告诉我如何知道它的图表系列索引?谢谢。

解决方案

这应该是工作的:

chart.seri es [index] .hide()



jsfiddle上的完整示例



(来自Simen Echholt评论的 UDP URL)


I need to be able to hide a Highcharts series from a button rather than the legend (the reason is that I need to toggle multiple groups from one button: Hiding _groups_ of series in Highcharts and jQuery: how to get acceptable performance? and for the reasons given in that post, I cannot use $(chart.series).each() with jQuery.

None of the following expressions have any effect (my chart object is named chart):

Chart.series.get(1).hide();
chart.series.get(1).hide();
$(chart.series[1]).hide();
$(chart.series["1"]).hide();
$(chart.series[1]).hide();
$(chart.series)["1"].hide();
$(chart.series)[1].hide();

Can someone please tell me how I can make a chart series hide if I know its index? Thanks.

解决方案

This should work:

chart.series[index].hide()

Full example on jsfiddle

(UDP URL from Simen Echholt comment)

这篇关于不使用图例隐藏Highcharts系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆