-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
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