robinrydberg-ce opened a new issue, #21845: URL: https://github.com/apache/echarts/issues/21845
### Version 6.1.0 (the same code order is on `master`) ### Link to Minimal Reproduction Paste into the [examples editor](https://echarts.apache.org/examples/en/editor.html): ```js const build = (data) => ({ xAxis: { type: 'category', data: ['a', 'b', 'c'] }, yAxis: {}, series: [{ id: 's', type: 'bar', universalTransition: true, itemStyle: { color: '#1f5fd6' }, data }] }); myChart.setOption(build([3, 5, 7])); setTimeout(() => { myChart.setOption( build([3, 5, 7].map((value) => ({ value, itemStyle: { color: '#14a04a' } }))), { replaceMerge: ['series'] } ); }, 1500); ``` ### Steps to Reproduce 1. Run the code above and wait until the columns have turned green. 2. Hover any column. ### Current Behavior The hovered column turns light **blue** (`rgba(34,104,235,1)`, lifted from `#1f5fd6`): the emphasis colour is lifted from the colour the column had before the update. ### Expected Behavior The hovered column turns light **green**, lifted from the colour it shows (`rgba(22,176,81,1)` with `universalTransition: false`). With `universalTransition: false`, or with `animation: false`, the hover colour is right. ### Environment ```markdown - OS: macOS - Browser: Chromium, canvas renderer (also reproduced in jsdom with the SVG renderer) - Framework: none ``` ### Any additional comments? In `renderSeries` (`src/core/echarts.ts`), `series:transition` runs before `updateStates`: 1. The universal transition calls `to.animateFrom({ style: from.style }, ...)` in `transitionBetween`. `animateFrom` writes the old style onto the element straight away and animates towards the new one, so `el.style.fill` holds the old colour for now. 2. `updateStates` then calls `savePathStates(el)`, which stores `el.style.fill` as `normalFill`. 3. `createEmphasisDefaultState` lifts `normalFill`, so the emphasis is computed from the old colour. It stays wrong until the next render saves the states again. Possible fixes: take the normal fill from the animation target rather than the current style when the element has a style animator running (as `getFromStateStyle` already does for state transitions), or save the path states before `series:transition`. -- 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]
