highcharts / highcharts-vue

Other
686 stars 150 forks source link

Bug with updating values #234

Closed HlebKrah closed 1 year ago

HlebKrah commented 1 year ago

Hello! I ran into a bug when updating chart data. I'm fine with most of the charts, but I ran into a problem with this particular one. I'm assuming it's because I'm using linkedTo . Here is the link to the sandbox: https://codesandbox.io/s/highcharts-vue-bug-with-update-values-tyhgfw?file=/src/components/Chart.vue

When you click on "first", the chart is displayed as needed. After that, you need to click on "second", and then again on "first". Now the chart will be displayed crookedly, although the data is the same.

I would be very grateful if you help me.

jszuminski commented 1 year ago

Hi @HlebKrah,

This issue stems from the Highcharts code and not Highcharts-Vue. As you can see in this demo: https://jsfiddle.net/BlackLabel/vgcknsLu/ the behavior is the same for Highcharts with Vanilla JS.

I've reported it on our Highcharts repository here: https://github.com/highcharts/highcharts/issues/19019 where you can track its progress.

I'll try to fix this issue or prepare a workaround for you, but for now you could just create two seperate charts and show/hide them based on the button click.

I'll keep you posted.

jszuminski commented 1 year ago

Hi,

The solution to this is adding ids to all of the series. Here's a demo: https://jsfiddle.net/BlackLabel/k3m95cuq/

If all series have ids the behavior of oneToOne update changes (https://api.highcharts.com/class-reference/Highcharts.Chart#update).

Also, in your case, you might want to get rid of pointPlacement as it causes strange positioning behavior.

In case you encounter any problems in the future do not hesitate to ask here or on our other support channels like our forum.