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

Multicategory sorting fixes #3362

Merged
merged 5 commits into from
Dec 21, 2018
Merged

Multicategory sorting fixes #3362

merged 5 commits into from
Dec 21, 2018

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Dec 21, 2018

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

@etpinard etpinard added bug something broken status: reviewable labels Dec 21, 2018
@@ -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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

, fullData?

Copy link
Collaborator

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)?

Copy link
Contributor Author

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.

Copy link
Collaborator

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 💃

Copy link
Contributor Author

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);
}
Copy link
Collaborator

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?

Copy link
Contributor Author

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?

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 👌

@archmoj
Copy link
Contributor

archmoj commented Dec 21, 2018

💃

@etpinard etpinard merged commit 997e720 into master Dec 21, 2018
@etpinard etpinard deleted the multicat-fixes branch December 21, 2018 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

multicategory sorting bugs
3 participants