David Marabottini
David Marabottini

Reputation: 327

Changing behavior of pie chart on clik on item legend

I'm working with react and I'm using highcharts, I'm creating a pie chart with a legend, but when I click in the legend, highcharts hide the corresponding part of the chart, but I wont that Highcharts select this part and the item clicked. I have tried to change this behavior inserting into this json

plotoption{pie {events: {
  legendItemClick: () => {
    alert('Hello world');
  }
}}},

but this code doesn't work.

I hope that someone could help me

Bye bye

Upvotes: 0

Views: 90

Answers (1)

ppotaczek
ppotaczek

Reputation: 39099

In pie series type you need to use legendItemClick event as point property:

plotOptions: {
    pie: {
        point: {
            events: {
                legendItemClick: () => {
                    alert('Hello world');
                }
            }
        }
    }
}

Live demo: http://jsfiddle.net/BlackLabel/k3b9f2u0/

API Reference: https://api.highcharts.com/highcharts/series.pie.point.events.legendItemClick

Upvotes: 1

Related Questions