Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cartesian 2dMap: implement sorting of categorical axes #3827
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
cartesian 2dMap: implement sorting of categorical axes #3827
Changes from 13 commits
e1716c7
d8ef1d7
9735683
5798dd8
56c6a4d
f878387
a34ca45
6b06516
59edb57
22cfa82
02e4089
5160948
e966030
ae3ecf5
e68c170
ebf545f
793c2a3
4d4b0b7
f180c79
0c41776
c7cd1f3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
adding
var axLetter = ax._id.charAt(0)
above probably wouldn't hurt.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.
Oh and can we use
ax._categoriesMap
instead of a (potentially) costlyindexOf
intoax._categories
?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.
One more thing, grepping for
xMap
andyMap
doesn't yield anything for me. Where do they come from?EDIT: Nevermind. I found them in
convert_column_xyz.js
.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.
Unfortunately, we cannot. For example, in the
heatmap_shared_categories
mock,_categoriesMap
links categoryTeam C
with index 2. That index is out of range for the second trace since it only has 2 columns. We really need to check whether each trace has data for a given category (and fill withBADNUM
) to fix #1117.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 very unfortunate, because
can be very costly.
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.
What if instead you made
_(x|y)CategoryMap
lookup objects?That is, instead of:
we could have
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.
About your questions regarding
hasOwnProperty
:hasOwnProperty
is roughly 6 times faster thanindexOf
However, we now run it for every element so in the end, I'm not sure which is faster with real data.
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.
Sorry @antoinerg I got confused (again). Your logic looks right to me.
The way you have it setup right now, I think we can get rid of the
axMapping.hasOwnProperty(ax._categories[i])
and just have:where the
+ 1
takes care of theind === 0
case.This comment is non-blocking as I don't expect much of a performance gain from it 😏
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.
Awesome trick :) Done in c7cd1f3
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.
💃 💃