-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
3D hover text fixes for date axes #1414
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
expect(tspan[2].innerHTML).toEqual(zLabel, 'z val on hover'); | ||
} | ||
|
||
it('should have', function(done) { |
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.
This isn't new with this PR, but this labeling is a little weird - it looks like you're including the message ('x val on hover' etc) as part of the test description, but doing that doesn't make it read out the right way either in the code or when the test fails.
The way I understand it, these tests should be described as:
describe('Noun', function() {
it('makes a sentence when you include the "it"', function() {
expect(true).toBe(false, 'more info if useful pinpoint the problem');
});
});
Which, when it fails, will make a message that starts with a sentence:
Chrome 56.0.2924 (Mac OS X 10.12.3) Noun makes a sentence when you include the "it" FAILED
Expected true to be false, more info if useful pinpoint the problem.
<traceback>
So in this case I'd have expected it to be something like:
describe('gl plot interactions', function() {
it('makes the right hover text and point data', function() {
// I'm not sure if the messages add much, I typically only include them
// when they include some variables either to determine which loop entry
// we failed on or some input to the calculation that led to the failure
// but having them doesn't detract from the test usability so you're
// welcome to keep them if you find them useful
expect(ptData.x).toBe('140.72');
});
});
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.
e9e0c83 - better?
src/plots/gl3d/scene.js
Outdated
var axis = scene.fullSceneLayout[axisName]; | ||
return Axes.tickText(axis, axis.c2l(val), 'hover').text; | ||
var calendar = trace[axis._id.charAt(0) + 'calendar']; |
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.
don't we actually want to use the axis calendar for this? (which is what you get if you omit calendar as an arg to d2l
)
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.
So, if I understand correctly: hover labels should show dates with the calendar of the axes (as opposed to the calendar of the trace)?
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.
Yes. That's what we do in 2D, and I think it makes sense, particularly when you're plotting different traces each with its own calendar, you want to be able to compare them within the system they were plotted on, irrespective of what the source data looks like.
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.
cbf1f86 - looks ok?
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.
Perfect - thanks for the test.
src/plots/gl3d/scene.js
Outdated
return Axes.tickText(axis, axis.c2l(val), 'hover').text; | ||
var calendar = trace[axis._id.charAt(0) + 'calendar']; | ||
|
||
return Axes.tickText(axis, axis.d2l(val, 0, calendar), 'hover').text; |
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.
I don't see a mock with category data in 3D, though it does work:
Plotly.newPlot(gd,[{x:[1,2,3],y:['a','b','c'],z:['2014-01-01','2016-01-01','2015-01-01'], type:'scatter3d'}])
I think this code is compatible with category data, but can you include a test for 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.
This one here
should do 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.
Oh perfect. My turn for new 👓
- AJ-proof description strings - add hover wrapper
💃 💃 |
fixes #1407