Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highchart: Only show one series at a time

I want to only show one series at a time. Also I want to disable the option to show no series at all.

I found this: http://forum.highcharts.com/viewtopic.php?f=9&t=6399 But the answer does not work.

like image 920
yoshi Avatar asked Nov 21 '25 03:11

yoshi


1 Answers

The problem was using outdated Highcharts url and old version of jQuery. To disable possibility for hiding series use legendItemClick. See: 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;
        }
      }
    }
  }
},
like image 194
Paweł Fus Avatar answered Nov 22 '25 15:11

Paweł Fus