chartjs / chartjs/Chart.js

Lib instantiates a new platform per chart

Open
#11,981 0 comments 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

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_

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.