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

Array passed as labels option is modified by Chart.js

Open frenkel opened this issue 1 year ago • 0 comments

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

frenkel avatar Sep 04 '24 09:09 frenkel