Jogai commented on issue #21200:
URL: https://github.com/apache/echarts/issues/21200#issuecomment-4612800319
Hitting this too on **6.0.0 and 6.1.0**. A few extra signals that might help
narrow down where it goes wrong, since the existing repro already shows the
symptom:
**It's `setTheme` itself, not the framework around it.** Calling
`chart.setTheme('dark')` directly on an instance that already has data is
enough to break it — no Vue/React/wrapper involved. After the call, the
populated series come back empty: data points go `null` and at least one whole
series disappears from `getOption().series`.
**The option still holds the data.** Immediately re-applying the same option
with `{ notMerge: true }` after `setTheme` restores every series and data
point. So `setTheme` isn't dropping the option you passed — the internal update
it triggers is discarding the already-built series.
**A layout warning fires synchronously during the call:**
```
[ECharts] Can't get DOM width or height. Please check dom.clientWidth and
dom.clientHeight. They should not be 0.
```
The container is a normal, non-zero size before and after, so this looks
like the update pass kicked off by `setTheme` runs against a
zero-size/!prepared state and throws away the series geometry.
**Where to look:** `ECharts.prototype.setTheme` → `prepare(this)` +
`updateMethods.update.call(this, { type: 'setTheme' })`. The `type: 'setTheme'`
update path is where things go off the rails.
Observed with the **SVG renderer**; I didn't bisect canvas vs svg, so can't
say whether it's renderer-specific.
Workaround for anyone blocked: re-init the instance on theme change (dispose
+ `init`) instead of calling `setTheme`, or re-apply the option with `notMerge:
true` right after.
--
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]