Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

Lib instantiates a new platform per chart

Open CatchABus opened this issue 1 year ago • 0 comments

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

CatchABus avatar Dec 30 '24 00:12 CatchABus