Highchart:一次只显示一个系列

yos*_*shi 3 javascript highcharts

我想一次只显示一个系列.此外,我想禁用显示任何系列的选项.

我发现了这个:http://forum.highcharts.com/viewtopic.php?f = 9&t = 6399 但答案不起作用.

Paw*_*Fus 7

问题是使用过时的Highcharts网址和旧版本的jQuery.禁用隐藏系列使用的可能性legendItemClick.见:http://jsfiddle.net/tK38J/65/

plotOptions: {
  series: {
    events: {
      show: function () {
        var chart = this.chart,
            series = chart.series,
            i = series.length,
            otherSeries;

        while (i--) {
          otherSeries = series[i];
          if (otherSeries != this && otherSeries.visible) {
            otherSeries.hide();
          }
        }
      },
      legendItemClick: function () {
        if (this.visible) {
          return false;
        }
      }
    }
  }
},
Run Code Online (Sandbox Code Playgroud)