chartjs / chartjs/Chart.js

Support for SharedWorkers

Open
#11,890 1 comment 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### 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:

https://github.com/user-attachments/assets/c5e9e8ee-d3a5-48a1-aacc-f8ea439bd8fe

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:

https://github.com/user-attachments/assets/9f746717-afe0-41f4-ad44-5d044f5d6999

Without looking deeper into the code base, I assume that the `chart.update()` logic is trying to use `requestAnimationFrame()`.

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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.