jk31
Posts: 1
Joined: Wed Jan 19, 2022 6:34 pm

Series data is not updating for no reason

Hello,

https://jsfiddle.net/7Ln2rf8h/4/

In my chart I want to display two lines. One line does not change, for the other line the user has the possibility to select the data he/she is interested in. The selection runs over a simple dropdown menu.

The problem I have is that updating the data after the selection doesn't quite work and I don't see the reason for that.

If you go to "Satisfaction" the data changes as desired, but if you go back nothing happens.

Thanks
magdalena
Posts: 517
Joined: Tue Aug 24, 2021 1:32 pm

Re: Series data is not updating for no reason

Hi jk31,

Welcome to our forum and thanks for contacting us with your question!

This is a standard JS problem. Your data are changing by references. According to the API, the new data array is passed by reference and may later be mutated when updating data. There are a few ways to prevent the modification of an object in Javascript, like for example using slice() or spread operator. You will find more information in the following links:

A similar Github thread:
https://github.com/highcharts/highcharts/issues/4259

Demo:
https://jsfiddle.net/BlackLabel/ao5tzq4p/
https://jsfiddle.net/BlackLabel/x45hg6yn/

API Reference:
https://api.highcharts.com/class-refere ... ies#update

Let me know if you have any further questions,
Regards!
Magdalena Gut
Developer and Highcharts Support Engineer

Return to “Highcharts Usage”