-
-
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
Multicategory sorting fixes #3362
Conversation
- so that we handle cross-trace sorting correctly
src/plots/plots.js
Outdated
@@ -2617,7 +2617,7 @@ plots.doCalcdata = function(gd, traces) { | |||
} | |||
|
|||
// clear stuff that should recomputed in 'regular' loop | |||
if(hasCalcTransform) clearAxesCalc(axList); | |||
if(hasCalcTransform) setupAxisCategories(axList); |
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.
, fullData
?
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.
maybe a can of worms, but is there a test for multicat + calctransforms (or non-calc-transforms for that matter)?
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.
Multicategory axes don't support transforms. I'm not sure how gracefully things fail though.
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.
OK, that's fine. Nothing more from me - I'll let one of the other folks give this a once-over and the 💃
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.
Transforms + multicategory tracked in -> #3363
ax.clearCalc(); | ||
if(ax.type === 'multicategory') { | ||
ax.setupMultiCategory(fullData); | ||
} |
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.
clearCalc
is also used in rangeslider.draw
and gl2d/scene2d
- do these need setupMultiCategory
? Should that just be part of clearCalc
for multicategory axes?
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.
clearCalc
is also used inrangeslider.draw
andgl2d/scene2d
- do these needsetupMultiCategory
?
setupMultiCategory
only needs to be called once (here in doCalcdata
, to fill in ax._muticatList
), so rangeslider don't need it, that's why I didn't put the setupMultiCategory
logic in clearCalc
. As for gl2d/scene2d
, gl2d subplots don't support multicategory
axes, so I think we're 👌
💃 |
fixes #3356 - and made me realised that
multicategory
are slightly more complicated than first expected.In brief, we need to (1) scan the data array (2) sort the resulting multi-category list (3) loop over the data arrays again to retrieve their
calcdata
values.cc @plotly/plotly_js