[IMP] chart: keep data series when switching chart types #5263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently if you have a bar chart with 3 ranges, switch to a gauge chart that only accept a single range, then back to a bar chart you will lose the 2 other ranges.
This commit fixes that. The ranges are kept in the store so we can switch between chart types without losing data.
There is one issue however: we do not make any difference between ranges lost because the chart type changed, and ranges lost because the user manually removed them. So if a user change chart type => remove a range => change chart type again, the removed range will be back.
This commit also fixed another issue that the chart creation context was not dependant on which figure was edited.
Task: 4282798
review checklist