You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this one is pure evil and deserves a new ticket => dedicated workers do have requestAnimationFrame(). no window => applying the polyfill for no reason in dedicated workers.
[update] new ticket: #11891
but inside my chart demo, there are no chart animations, so this one does not even get called.
if i call this one for 2 charts (bar & line):
addRandomData(opts) {
let max = Neo.isNumber(opts?.max) ? opts.max : 20,
min = Neo.isNumber(opts?.min) ? opts.min : 0,
value = Math.floor(Math.random() * (max - min + 1) + min);
this.charts.forEach(chart => {
chart.data.datasets[0].data.push(value);
chart.data.labels.push('Random ' + (value));
chart.update()
})
}
this feels like too many redundant calls, but i might be wrong.
further drilling in i ended up inside render() which then triggered draw() for several contexts.
the methods were executed very fast inside my SharedWorker, but i am lacking the time to drill down deeper to see which delayed callbacks should get triggered, but won't.
Expected behavior
I am actually not sure if this is a feature request or a bug report.
Am I the first one trying to use this library inside a SharedWorker?
If I am using a dedicated worker:
Screen.Recording.2024-08-31.at.16.27.25.mov
this works fine (except for the resize-logic, which i will look into).
Current behavior
If I am switching the dedicated worker to a shared worker, i get:
Screen.Recording.2024-08-31.at.16.23.20.mov
Without looking deeper into the code base, I assume that the
chart.update()
logic is trying to userequestAnimationFrame()
.This API is not available inside SharedWorkers. If there is a fallback, it needs more love.
Reproducible sample
https://github.com/neomjs/chartjs-demo
Optional extra steps/info to reproduce
No response
Possible solution
No response
Context
No response
chart.js version
v4.4.4
Browser name and version
No response
Link to your project
No response
The text was updated successfully, but these errors were encountered: