-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Sort + set 'categoryarray' #1689
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
Conversation
src/plots/plots.js
Outdated
@@ -2099,6 +2085,26 @@ plots.doCalcdata = function(gd, traces) { | |||
} | |||
}; | |||
|
|||
plots.initCategories = function(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.
is there a reason to export this fn?
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.
No.
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.
Not a big deal, but I'd prefer not to since it goes into Plotly.Plots
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.
Yeah, good call 👍
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.
done in b8e5f52
// initialize the category list, if there is one, so we start over | ||
// to be filled in later by ax.d2c | ||
for(var i = 0; i < axList.length; i++) { | ||
axList[i]._categories = axList[i]._initialCategories.slice(); |
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.
Certainly would have been caught by now if this could ever be undefined, right? (I'm too cautious about checking for undefined unnecessarily)
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.
Yeah. That _initialCategories
thing is set in the defaults. Calling Plots.doCalcdata
before supplyDefaults
is like 🔫 yourself in 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.
Haha the squirt gun. And then your socks are wet for the rest of the day.
💃 very clean! But consider #1689 (comment) before merging. |
currently gives:
where the categories are re-arranged after the
sort
transform - which is consistent with how we handle categories infilter
transforms. See PR #1260 for more details.But setting
layout.xaxis.categoryarray: ['A', 'B', 'C]
-- which implies that the category positions are fixed -- curently gives the same results as above.With commit 7a2a2e1
now gives:
where
categoryarray
is honored.cc @n-riesco @alexcjohnson