echarts
echarts copied to clipboard
[Bug] Sunburst diagram resets to the root view if data is updated
Version
5.4
Link to Minimal Reproduction
https://jsfiddle.net/eLojgs21/
Steps to Reproduce
- Click on a (sub-) segment in the sunburst chart, e.g. "Uncle Leo"
- select a category in the legend
Current Behavior
If zoomed into a sunburst diagram and selecting a category, the (root) view is resetted and gets zoomed to the root level.
Expected Behavior
This behavior is triggered, through setting new data with the setOption
function. Afterwards the function optionUpdated is triggered and resets the root view of the component.
I don't know if it's really a bug and/or a feature request, but it should be possible to update the data and don't change the actual view of the diagram. Maybe there is a workaroudn for this, which I don't know.
Environment
- OS: Windows
- Browser: Chrome 120.0.6099.71
- Framework: -
Any additional comments?
Is there a way to show the updated data without the reset of the view?
Maybe a good solution would be to add a new feature initialRootNode
which allows to specify the initial view of the sunburst diagram (somewaht similar to initialTreeDepth
). This way setOption
could be triggered and used to restore the previous view of the sunburst chart.
@MatthiasMert
I played around with the source code and experimented a little bit. The repainting of the view is done by calling this function. Then the view is resetted and repainted. I also found this function call as an option, which is apparently used when you click on an element in the sunburst diagram.
Do you have any idea how this can be used to prevent a complete reset to the root node?