-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Handle streamtube coordinates in string format and handle different data orders in isosurface and volume #4431
Conversation
src/traces/streamtube/calc.js
Outdated
@@ -206,6 +206,9 @@ function distinctVals(col) { | |||
function filter(arr, len) { | |||
if(len === undefined) len = arr.length; | |||
|
|||
// no need for casting typed arrays to numbers | |||
if(Lib.isTypedArray(arr)) return arr.slice(0, len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use arr.subarray()
for typed arrays, as .slice
isn't supported in older browsers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call.
Wondering if we need to slice the array at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slice
(or subarry) is needed for distictVals
to work correctly.
But it may be better not to slice if the length is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it may be better not to slice if the length is correct.
that could be a nice optimisation for typed arrays, but for regular arrays we'll need to slice in general to cast numerical-strings items w/o mutating.
- computed trace._len and process grid at the start of calc - apply subarray instead of slice for typed arrays - improve streamtube jasmine test
- add image tests for various grid fill orders - add jasmine tests for various grid fill orders and data types
…re them at trace._x etc. - rename previous trace._x, _y, _z & _intensity as well as trace._i, _j & _k to trace._meshX, etc. to avoid name conflicts
Nice job @archmoj - this PR is looking very nice now, one commit away from merging. |
Beautiful fix!! Thanks very much for bringing some sanity into streamtube-land 💃 💃 💃 |
Fixes #4427:
Whereas raw x, y and z values were used in
streamtube
calc step, in order to find the order of data, it was necessary to ensure casting to numbers before comparing two values.Before
After
And fixes #4440:
Similar to #4271, this PR fixed the data cube order issue so that the
value
as well asx
,y
andz
arrays could be filled in different orders.Before
After
@plotly/plotly_js