xDanny117
Posts: 9
Joined: Tue Apr 09, 2019 9:50 am

Series linkedTo property and Legends

Hi there,

I am having issues with the "linkedTo" property. I am trying to link multiple series together for the purposes of dependent sorting (which is working great) but I also want the legend items to be independent.

Say I have 5 series - A,B,C,D and E.

When I link B,C,D and E to series A, clicking on A's legend item causes the rest of the series to disappear from the chart.

Is there a way to override this functionality? Ideally I still want the 5 series to be linked for sorting purposes, but when I click on A's legend item, only A disappears. B --> B disappears and so on.

Thanks!
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Series linkedTo property and Legends

Hello, thanks for contacting us with your question! Unfortunately, we don't have the functionality, that you described. as it is written in API
When two series are linked, only the first one appears in the legend. Toggling the visibility of this also toggles the linked series.
You could create your custom property, (e.g. _linkedTo) which will just do this one thing with sorting. Please, share the demo, where you apply the sorting function. It will allow me to adjust the solution to your case :)

In case of any further questions feel free to contact us again! Kind regards,
Paweł Lysy
Highcharts Developer
xDanny117
Posts: 9
Joined: Tue Apr 09, 2019 9:50 am

Re: Series linkedTo property and Legends

Hi Pawel,

Thanks for getting back to me on this.

I have shared a simple example of what I am trying to achieve. When I click on the "John" legend item, I do not want the other series Jane/Joe to disappear. The legend functionality should ideally work as normal, where clicking the item just hides the series you clicked on.

https://jsfiddle.net/h3Lzj59r/

I look forward to seeing how you implement a custom property to get around this, it will be a great help!
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Series linkedTo property and Legends

Hi! But what is wrong with the demo, you shared? It does exactly what you wanted it to do, isn't it?
Paweł Lysy
Highcharts Developer
xDanny117
Posts: 9
Joined: Tue Apr 09, 2019 9:50 am

Re: Series linkedTo property and Legends

Hi Pawel,

On the demo I shared, when I click on the right-hand legend item "John" - all series on the chart disappear.

I do not want this to happen - instead when I click on "John", only the "John" series should disappear and the others should remain visible.

I hope that clears things up?

Daniel
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Series linkedTo property and Legends

OK, I understand what you want to achieve. But the sorting works without the linkedTo property. Check this demo -> https://jsfiddle.net/BlackLabel/orqmueph/ Is everything ok with it? Kind regards,
Paweł Lysy
Highcharts Developer
xDanny117
Posts: 9
Joined: Tue Apr 09, 2019 9:50 am

Re: Series linkedTo property and Legends

Hi Pawel,

The sorting I require is dependent sorting which unfortunately requires the linkedTo property to function. This works as intended in the demo I shared.

If you were to disable the linkedTo property in my demo and change some values, then the categories get jumbled up and "Apples" values can appear beside the "Oranges" category etc.
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: Series linkedTo property and Legends

It seems that these options are strictly correlated, and it is hard to split them apart. You can file it as a feature request on our github: https://github.com/highcharts/highchart ... new/choose

Our developers will answer you there! Kind regards,
Paweł Lysy
Highcharts Developer

Return to “Highcharts Usage”