Xnadir opened a new pull request, #21867: URL: https://github.com/apache/echarts/pull/21867
## Brief Information This pull request is in the type of: - [x] bug fixing - [ ] new feature - [ ] others ### What does this PR do? Resets the graph's main group transform when the series is not on its own view coordinate system, so a graph set on cartesian2d after a graph on the default view is placed on the grid. ### Fixed issues - #21857: Graph on cartesian2d is misplaced after setOption from a graph on the default (view) coordinate system ## Details ### Before: What was the problem? `GraphView.render` calls `applyViewCoordSysTransToElement` on `_mainGroup` only when the series has its own view coordinate system (`getOwnRoamViewCoordSys`). On cartesian2d it left the group as it was. After a graph on the default `view` coordinate system, the group kept that view's scale and offset, so the nodes and edges of the cartesian graph did not line up with the axes. In the new unit test it kept `x: 50, y: 30, scale: 0.3`. ### After: How does it behave after the fixing? When there is no own view coordinate system, `render` stops any running transform animation on `_mainGroup` and resets it to `x: 0, y: 0, scaleX: 1, scaleY: 1`. The nodes are already laid out in global coordinates on cartesian2d, so this matches a chart created directly with the cartesian option. New unit test `test/ut/spec/series/graph.test.ts`: render a graph on the view coordinate system, then `setOption(cartesianOption, true)`. The main group's transform must equal that of a chart created directly with `cartesianOption`, which is the identity. It fails on `master` with `[50, 30, 0.3, 0.3]`. Ran locally: - `npx jest --config test/ut/jest.config.cjs test/ut/spec` (all unit tests pass); - `eslint` on the changed files; - `tsc -p tsconfig.json --noEmit`. ## Document Info - [x] This PR doesn't relate to document changes ## Misc ### Security Checking - [ ] This PR uses security-sensitive Web APIs. ### ZRender Changes - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx). ### Related test cases or examples to use the new APIs N.A. ### Merging options - [ ] Please squash the commits into a single one when merging. ### Other information This change was written with the help of Claude Code (AI). I reviewed it and ran the tests above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
