Repository navigation
Fix parcoords dimensions values & line coloring error with integer TypedArray - #3598
Conversation
|
Thanks for the fix @archmoj! It looks good to me 👍 I am wondering if we should add a parcoords mock with |
|
@antoinerg thanks for the review & comment. I am not sure if we could make a JSON mock with typed arrays. So I may add a jasmine test. |
|
@antoinerg Please note that e8cc760 is also added concerning my comment here. |
You're probably right 😄 Thanks for the jasmine tests! I confirm this PR fix both issues in #3595 but I wonder why Nice work @archmoj |
| var values = coerce('values'); | ||
| if(!Array.isArray(values) && Lib.isArrayOrTypedArray(values)) { | ||
| // should convert typed arrays e.g. integers to real numbers | ||
| values = dimensionOut.values = Array.prototype.slice.call(values); |
There was a problem hiding this comment.
Nop. Let's not do this during defaults to remain consistent with other typed-array-to-array blocks.
Move this to parcoords/calc.js.
There was a problem hiding this comment.
If we can keep typed arrays as typed array and handle them correct downstream, then we shouldn't convert them.
That makes perfect sense!
| var lineColor = coerce('line.color', defaultColor); | ||
| if(!Array.isArray(lineColor) && Lib.isArrayOrTypedArray(lineColor)) { | ||
| // should convert typed arrays e.g. integers to real numbers | ||
| lineColor = traceOut.line.color = Array.prototype.slice.call(lineColor); |
because we don't want to do that in general. If we can keep typed arrays as typed array and handle them correctly downstream, then we shouldn't convert them. See for example plotly.js/src/plots/cartesian/set_convert.js Lines 516 to 537 in ecfa45a |
See #913 |
| return out; | ||
| } | ||
|
|
||
| function isTypedArray(a) { |
|
Nicely done 💃 |
Fixes two issues reported & discovered in #3595 resulted from
integerrounding errors.color.linetyped arrays e.g. int32dimensions.valuestyped arrays e.g. int32@plotly_js
Codepen Before.
Codepen After.