yqtian-se opened a new issue, #21857: URL: https://github.com/apache/echarts/issues/21857
### Version 6.1.0 (also current `master` 34f4d927e) ### Link to Minimal Reproduction https://echarts.apache.org/examples/en/editor.html?code=lZIxb8IwEIV3fsVtASkqSboFUQl1QB2qDnSrGExyEKuJHewLxEX8956TBmilVuoQS867e_ru-TKtLMFB4nFpRF3AHE4jAItGok3hzV8AyNWYQrDzFUEIpXC6If6htEK-W1dtdLmSH1yURGHXkgsSvh-UqHxvzXVtClEIjk84h3CR9r0UR1Gvxiyve5dSqvcOA6xuTDYYkTA79AD7gEu5ko_zbNTPkglDaKVQtwO1i1ay0WkYJROEO20cm210o3Jh3FLUKWxFaTEc6APBerDxRxasGZqd3A-ngygbZAyv_S-2TGuTS8UkK2cJqw7riz3J_8415qju-UuiX5Nidcgp7vMelPiqJLf56ZqkVpzYZR1mo-kUFltCwx6WiY6SsgJIAxV4TRq6Ee_giSwonaOFXKuAPBRCUwN3cRN3iJbjGVmkV1khhzEeT2D-AJV7LNjrjoWXjmH8_RG7ZdH0jAydApkG4TwJu42ZzD4B&enc=deflate ```js const viewGraph = { series: [{ type: 'graph', layout: 'none', symbolSize: 20, data: [{ name: 'p', x: 0, y: 0 }, { name: 'q', x: 1000, y: 10 }], links: [{ source: 'p', target: 'q' }] }] }; const cartesianGraph = { xAxis: { type: 'category', boundaryGap: false, data: ['a', 'b', 'c'] }, yAxis: { type: 'value' }, series: [{ type: 'graph', layout: 'none', coordinateSystem: 'cartesian2d', symbolSize: 20, data: [10, 30, 20], links: [{ source: 0, target: 1 }, { source: 1, target: 2 }] }] }; option = viewGraph; // After 1 s, switch to the cartesian graph. Its nodes don't line up with the axes: setTimeout(() => myChart.setOption(cartesianGraph, { notMerge: true }), 1000); ``` ### Steps to Reproduce 1. Render a graph series on its default `view` coordinate system (`layout: 'none'` with x/y). 2. `setOption` an option whose graph series is on `cartesian2d` (with `notMerge: true` here; with `roam: true` or `false` alike). ### Current Behavior The nodes and edges of the cartesian graph are scaled and translated by the transform of the previous `view` graph, so they do not line up with the axes. ### Expected Behavior The graph is placed on the grid exactly as in a chart created directly with the cartesian option. ### Environment - OS: any (also reproduced with the SVG renderer in Node.js SSR) - Browser: any - Framework: none ### Any additional comments? Cause: `GraphView.render` applies the view coordinate system's transform to its main group only when the series has its own `View` coordinate system (`if (ownCoordSys) applyViewCoordSysTransToElement(mainGroup, ...)`). When the reused view later renders a graph on an external coordinate system, the old transform is never reset. I can send a PR. -- 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]
