holtc
holtc

Reputation: 1820

Dynamically Change onSeries property

Say I have 3 series with ids series1, series2 and flags. Initially flags has its onSeries property set to series1. When I click on the legend to hide series1, is there a way in that legendItemClick event to dynamically set the onSeries property of flags to series2? I can't seem to find a method of doing so. Thanks!

Upvotes: 0

Views: 64

Answers (1)

morganfree
morganfree

Reputation: 12472

You need to update flags series via Series.update() and change onSeries property.

legendItemClick: function (e) {
      e.preventDefault(); // prevent toggle visibility
      this.chart.get('flags-series').update({ // get the flag series and update it
        onSeries: this.options.id
      });
    }

example: http://jsfiddle.net/pfx77nn4/

Upvotes: 1

Related Questions