Trigger a click event on a legend item in Highchart

Sometimes you have a few series in your chart and you want to turn off some of them, maybe because they are too big thus skewing the rest of the data. See below for example, the green bar is just too long compared to the other two.


We know that mouse-clicking on a legend item can turn series on and off. Here after clicking on the green legend item, we see:


To do that programmatically, here is how you do it.

var chart;
$(document).ready(function() {
  chart = new Highcharts.Chart({
    // blah blah blah...

  // auto click on the 3rd legend label to disable that series from showing up

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s