-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixes #1324 which occurs due to a collision in the datafn. #1337
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/cartesian/axes.js
Outdated
@@ -1604,7 +1604,7 @@ axes.doTicks = function(gd, axid, skipTitle) { | |||
var axletter = axid.charAt(0), | |||
counterLetter = axes.counterLetter(axid), | |||
vals = axes.calcTicks(ax), | |||
datafn = function(d) { return d.text + d.x + ax.mirror; }, | |||
datafn = function(d) { return [d.text, d.x, ax.mirror].join('\u0000'); }, |
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.
Nice fix 🎉
I'm curious to hear why you chose \u0000
instead of say -
here?
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.
We used \u0000 as a workaround but putting it on the end of our ticktext values, but not causing any visible change. No solid reason we couldn't use something else here.
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. In this case, I would prefer changing the join
argument to -
if you don't mind.
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.
Updated
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.
Actually, perhaps a character that's not possible in a stringified number, like '_'
? It would be rather pathological, but Imagine you had
xaxis: {
type: 'linear',
title: 'Grade',
tickvals: [-1, 1],
ticktext: ['A', 'A-']
}
(Nice debugging BTW @rpaskowitz !)
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.
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.
@rpaskowitz It would be nice to add an image test for 🔒ing down this behavior. To do so, add an image test mock data/layout JSON in the |
f5ad68f
to
53fa350
Compare
Added a mock and tested it pre/post change and confirmed it's working as intended. I don't think I'll be able to get to generating the baseline however. Any recommendation on adding that in a separate PR, sending me a baseline and my adding it to this PR, other...? |
No worries, we'll take it from here once #1337 (comment) is addressed. Thanks again for this awesome PR! |
In the example Jan 11 is at x = 0 while Jan 1 is at x = 10. Concatenating the two results in both being "Jan 110".
53fa350
to
2c549b2
Compare
@rpaskowitz I added the baseline image in #1347 which includes your commit. I will close this PR and merge #1347 Thanks again 🍻 |
In the example Jan 11 is at x = 0 while Jan 1 is at x = 10. Concatenating the two results in both being "Jan 110".
Join the fields with \u0000 instead of simple concatenation to prevent the collision.