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

Array passed as labels option is modified by Chart.js #11893

Open
frenkel opened this issue Sep 4, 2024 · 0 comments
Open

Array passed as labels option is modified by Chart.js #11893

frenkel opened this issue Sep 4, 2024 · 0 comments

Comments

@frenkel
Copy link

frenkel commented Sep 4, 2024

Expected behavior

When passing an array of labels I do not expect Chart.js to modify that array, but instead use a copy of it.

Current behavior

Values in the array are different after Chart.js was run.

Reproducible sample

https://jsfiddle.net/tsrabmgo/

Optional extra steps/info to reproduce

See difference with and without the array_var line commented/uncommented.

Possible solution

Call .slice() on the value received as labels array.

Context

No response

chart.js version

latest

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