apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.3k stars 19.61k forks source link

[Bug] Restoring the position of nodes and the viewport of the graph #19008

Open KondakovArtem opened 1 year ago

KondakovArtem commented 1 year ago

Version

5.4.3

Link to Minimal Reproduction

https://stackblitz.com/edit/stackblitz-echarttest?file=src%2Fmain.ts

Steps to Reproduce

Open project click on "Toggle"

drag on nodes

video: https://www.awesomescreenshot.com/video/20041073?key=58f3ff3ad39082214c75241f612a52d3

Current Behavior

Nodes incorrectly restore their position on the second instance of echarts

Expected Behavior

Nodes and viewport must exactly match the original

Environment

- OS:Ubuntu 24.04
- Browser: Chome 114.0
- Framework: Angular 16

Any additional comments?

The problem is that I can't restore the exact state of the graph by the value of zoom, center and node coordinates The nodes either move out or stretch, and if you apply a zoom other than 1, then no matter how you set the value of the nodes by dragging, they seem to be in an invisible bounding box

https://www.awesomescreenshot.com/video/20041073?key=58f3ff3ad39082214c75241f612a52d3

helgasoft commented 1 year ago

The Reproduction is definitely not Minimal. Could you please describe the problem starting with this one?

KondakovArtem commented 1 year ago

Here I tried to make a minimal reproduction. https://codesandbox.io/s/simple-graph-forked-fml7wd?file=/index.js The meaning is as follows - it is necessary to get its state from the first graph and transfer it to the second (node coordinates, scale and position of the viewport) If you use the mouse to move the viewport or nodes, then the display on the two graphs begins to differ

https://www.awesomescreenshot.com/video/20093672?key=79126b30463eed8ba69bc3bbc927a9d4