vinita
Posts: 1
Joined: Wed Aug 10, 2022 12:38 pm

Single legend representing multiple series

I can use showInLegend to hide legends when there are multiple series. Is it possible to represent all the series by single legend? Thank you!
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Single legend representing multiple series

Hello,

Yes, you can use linkedTo property to link some series with others.

Demo: https://jsfiddle.net/BlackLabel/ju83nosf/
API: https://api.highcharts.com/highcharts/s ... e.linkedTo

Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
thais.molica
Posts: 2
Joined: Wed Jan 03, 2024 8:46 pm

Re: Single legend representing multiple series

How can I make the single legend hover highlight multiple series as well?
kamil
Posts: 64
Joined: Mon Mar 04, 2024 8:26 pm

Re: Single legend representing multiple series

Hi there,
Thank you for contacting us.
The functionality that you described is not available in Highcharts by default. However, a simple core code modification makes it work.
Live demo: https://jsfiddle.net/BlackLabel/L83hn1wd/

The only two pieces I've added are:

Code: Select all

             if (item.linkedSeries[0]) {
               item.linkedSeries[0].setState('hover')
             }

&

Code: Select all

             if (item.linkedSeries[0]) {
               item.linkedSeries[0].setState()
             }

Please let us know if you have any further questions.
Best regards!
Kamil Kulig
Highcharts Developer

Return to “Highcharts Usage”