Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lib instantiates a new platform per chart #11981

Open
CatchABus opened this issue Dec 30, 2024 · 0 comments
Open

Lib instantiates a new platform per chart #11981

CatchABus opened this issue Dec 30, 2024 · 0 comments

Comments

@CatchABus
Copy link
Contributor

CatchABus commented Dec 30, 2024

Expected behavior

If I were to use a certain custom platform for my charts, I'd expect that I'd be able to reuse the same platform instance for all of them based on the flexibility of platform methods and their arguments.

Current behavior

Right now, if I define a class to be a platform for let's say 20 charts, library will create 20 platform instances in total and that's not very memory-efficient.
See https://github.com/chartjs/Chart.js/blob/master/src/core/core.controller.js#L154

Reproducible sample

N/A

Optional extra steps/info to reproduce

No response

Possible solution

Accept a platform instance as an argument instead of a platform class.

Context

No response

chart.js version

4.4.7

Browser name and version

No response

Link to your project

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant