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

Auto scaling of y-axes doesn't work if data is typed array #5681

Closed
jalajc opened this issue Aug 11, 2018 · 1 comment
Closed

Auto scaling of y-axes doesn't work if data is typed array #5681

jalajc opened this issue Aug 11, 2018 · 1 comment

Comments

@jalajc
Copy link

jalajc commented Aug 11, 2018

Auto scaling of y-axes doesn't work if data is typed array say e.g.
myMixedChart.data.datasets[0].data = Uint32Array_data_array;

However, labels (x-axis) redraw as per new data (even when typed array is used).

Current Behaviour/Expected Behavior

I wouldn't call this strictly a bug, but since lot of folks use serialization libraries such as protobuff etc, de-serialization results into typed arrays. which when assigned to data of chart object, auto-scaling fails and is hard to debug (untill you know typed array is causing issue). Expected behavior is auto-scaling should work on typed arrays too.

Possible Solution

use Array.from before assigning typed array to chart data. e.g.
myMixedChart.data.datasets[0].data = Array.from(Uint32Array_data_array);

Context

Using serialization library which returns chart data as binary buffer. Once de-serialization is done, all the data arrays are typed arrays.

Environment

  • Chart.js version: 2.7
@etimberg
Copy link
Member

This was likely solved by #5905 and released in v2.8

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

2 participants