Chart.update with oneToOne removes series when updating axes
Posted: Wed Sep 29, 2021 11:47 am
Hello,
I've upgraded Highcharts from 8.1 to the latest 9.2.2 and the flip axes usecase fails.
Calling `chart.update(updatedConfig, true, true, false)` updates the axis information, but it also removes the series. This is unexpected becase the `updatedConfig` object does not have the `series` field.
It turns out that the problem is related to the axis `id` field. `chart.update` removes the series (and sometimes the axes) if the `axis.id` is not empty.
The minimal code to reproduce the problem:
https://jsfiddle.net/mariusseiceanu/kuozy207/9/
Test results with different configurations
1. Initial Config
xAxis - no id
yAxis - no id
Update with
xAxis - no id
yAxis - no id
OK - Axis updated
OK - series untouched
2. Initial Config
xAxis - no id
yAxis - no id
Update with
xAxis - id: 'x1'
yAxis - id: 'y'
OK - Axis updated
OK - series untouched
3. Initial Config
xAxis - id: 'x'
yAxis - id: 'y'
Update with
xAxis - no id
yAxis - no id
OK - Axis updated
OK - series untouched
4. Initial Config
xAxis - id: 'x'
yAxis - id: 'y'
Update with
xAxis - id: 'x'
yAxis - id: 'y'
OK - Axis updated
OK - series untouched
5. Initial Config
xAxis - id: 'x'
yAxis - id: 'y'
Update with different axis id
xAxis - id: 'x1'
yAxis - id: 'y1'
OK - Axis updated
ERR - series removed
6. Initial Config
xAxis - id: 'x'
yAxis - id: 'y'
Update with flipped axis id
xAxis - id: 'y'
yAxis - id: 'x'
ERR - Axis removed
ERR - series removed
I've upgraded Highcharts from 8.1 to the latest 9.2.2 and the flip axes usecase fails.
Calling `chart.update(updatedConfig, true, true, false)` updates the axis information, but it also removes the series. This is unexpected becase the `updatedConfig` object does not have the `series` field.
It turns out that the problem is related to the axis `id` field. `chart.update` removes the series (and sometimes the axes) if the `axis.id` is not empty.
The minimal code to reproduce the problem:
https://jsfiddle.net/mariusseiceanu/kuozy207/9/
Test results with different configurations
1. Initial Config
xAxis - no id
yAxis - no id
Update with
xAxis - no id
yAxis - no id
OK - Axis updated
OK - series untouched
2. Initial Config
xAxis - no id
yAxis - no id
Update with
xAxis - id: 'x1'
yAxis - id: 'y'
OK - Axis updated
OK - series untouched
3. Initial Config
xAxis - id: 'x'
yAxis - id: 'y'
Update with
xAxis - no id
yAxis - no id
OK - Axis updated
OK - series untouched
4. Initial Config
xAxis - id: 'x'
yAxis - id: 'y'
Update with
xAxis - id: 'x'
yAxis - id: 'y'
OK - Axis updated
OK - series untouched
5. Initial Config
xAxis - id: 'x'
yAxis - id: 'y'
Update with different axis id
xAxis - id: 'x1'
yAxis - id: 'y1'
OK - Axis updated
ERR - series removed
6. Initial Config
xAxis - id: 'x'
yAxis - id: 'y'
Update with flipped axis id
xAxis - id: 'y'
yAxis - id: 'x'
ERR - Axis removed
ERR - series removed