如何在组合高位图中隐藏系列数据 [英] how to hide series data in combination high charts

查看:78
本文介绍了如何在组合高位图中隐藏系列数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用联合收割机high charts.我需要在单击特定图例时隐藏特定的饼图和柱形图数据.如果我使用:

I am using combine high charts. I need to hide a particular pie chart and column chart data while clicking a particular legend. If i use:

series[i].data[index].remove()

这将删除该值,但是在单击图例时无法再次显示该值.

That removes the value but not able to show that value again while clicking the legend.

series[i].data[index].hide()

请参阅此 JSFidddle-示例,但是我得到了error,例如这不起作用.我该如何解决?

Refer to this JSFidddle - Example which I tried but I get an error like This is not function. How do I solve this?

推荐答案

您可以在点SVG图形元素上使用hide方法:

You can use hide method on point SVG graphic element:

    events: {
      legendItemClick: function(e) {
        var index = this.index;
        var chart = this.series.chart;
        var series = chart.series;
        var len = series.length - 1;

        if (this.visible) {
          series[0].points[index].graphic.hide();
        } else {
          series[0].points[index].graphic.show();
        }
      }
    }

实时演示: https://jsfiddle.net/BlackLabel/d8uaxefo/

API参考: https://api.highcharts.com/class- reference/Highcharts.SVGElement#hide

这篇关于如何在组合高位图中隐藏系列数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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