yqtian-se opened a new issue, #21859: URL: https://github.com/apache/echarts/issues/21859
### Version 6.1.0 (also current `master` 34f4d927e) ### Link to Minimal Reproduction https://echarts.apache.org/examples/en/editor.html?code=lZIxT-RADIX7_RWvSyKNwsJyTU6cdHc9FNAhCidjNiOSzGrGC0Ro_zueSRaJksbK-Fn29-x0foqCkV4YNyinCjd_UH5sAJrcSOL81OCZhshGcwc_UGjwcUqPQNYd4993FzWjHd4bXCMrNO0HPgsyH7hB0ZHw3oe5MLAk1OCxIP0u2hS6FGwKXDzVcXAdl1sDpcn9IgfH2uwxceHcsaVQJBXovA_WTTrhfo7Co4qZdJUHanlIKLH3bw0kHNmolegWd8XorB24WGbhjHdlcFlruKqvDXb6-Aamlaenzan6vfGH1EaXl3ZY7jRzcYFLKC5ZC3nzWK2rhRr_KESQQWvQYfSvStIeBdKzCwtoxAvzIWXgB4vgJV8BpdW9WjAosDoOgTupmk1keXAj-6OUZT7eOP_vKUitwl1GKzPYr6pSD9vtdgHcJUAtyXMijTps8UF7clONWy-9m_boej0mR4N5rV0Z_fOXi0zIEJ_1lWz5B36It8t4nw&enc=deflate ```js const make = (n) => ({ animation: false, polar: {}, radiusAxis: { max: 4 }, angleAxis: { type: 'category', data: ['a', 'b', 'c', 'd', 'e'].slice(0, n) }, series: [{ type: 'bar', coordinateSystem: 'polar', label: { show: true, position: 'middle' }, data: [2, 1.2, 2.4, 3, 1].slice(0, n) }] }); option = make(3); // 1 s: add two categories. Bars a, b, c move, but their labels keep the old rotation (d and e are correct): setTimeout(() => myChart.setOption(make(5)), 1000); // 3 s: set the same option again. Nothing changes, yet the labels of a, b, c rotate to the correct angle: setTimeout(() => myChart.setOption(make(5)), 3000); ``` ### Steps to Reproduce 1. Create a polar bar chart with labels (`position: 'middle'` makes it easiest to see, since labels are rotated along the bar). 2. Update it with `setOption` so the existing bars change their angles. Any of these triggers it: - more categories on `angleAxis`; - only new data values, while the category axis is `radiusAxis`; - moving the category axis between `radiusAxis` and `angleAxis` with `notMerge: true`. 3. Setting the same option again fixes the labels (see the link above). ### Current Behavior Two things go wrong for the bars that already existed: 1. **Rotation:** the labels keep the rotation of the old bar angles. This affects `label.position` `middle`, `insideStart`, `insideEnd`, `start`, `end` and `outside`; `inside` is not affected. Newly added bars are correct. 2. **Position:** when the category axis moves between `radiusAxis` and `angleAxis` (`notMerge: true`), labels with position `insideStart`, `insideEnd`, `start` or `end` are also placed and aligned for the old orientation, not just rotated wrongly. Example: `label: { show: true, position: 'insideStart' }`, data `[2, 1.2, 2.4]`, first with the category on `radiusAxis` (`angleAxis: { max: 4 }`), then `setOption` with the category on `angleAxis` (`radiusAxis: { max: 4 }`) and `notMerge: true`. ### Expected Behavior Label rotation and position match the updated bars, as in a chart created directly with the final option. ### Environment - OS: any (also reproduced with the SVG renderer in Node.js SSR) - Browser: any - Framework: none ### Any additional comments? Cause: in `BarView._renderNormal`'s update branch, `updateStyle()` runs before `updateProps(el, { shape: layout })`. `updateStyle` calls `setSectorTextRotation(el, ...)`, which reads the angles from `el.shape`, i.e. the previous layout. 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]
