Skip to content

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

Merged
merged 4 commits into from
Feb 27, 2017
Merged

3D hover text fixes for date axes #1414

merged 4 commits into from
Feb 27, 2017

Conversation

etpinard
Copy link
Contributor

fixes #1407

@etpinard etpinard added status: reviewable bug something broken labels Feb 24, 2017
@etpinard etpinard added this to the 1.24.0 milestone Feb 24, 2017
expect(tspan[2].innerHTML).toEqual(zLabel, 'z val on hover');
}

it('should have', function(done) {
Copy link
Collaborator

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');
    });
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

e9e0c83 - better?

var axis = scene.fullSceneLayout[axisName];
return Axes.tickText(axis, axis.c2l(val), 'hover').text;
var calendar = trace[axis._id.charAt(0) + 'calendar'];
Copy link
Collaborator

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)

Copy link
Contributor Author

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

Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cbf1f86 - looks ok?

Copy link
Collaborator

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.

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

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 👓

@alexcjohnson
Copy link
Collaborator

💃 💃

@etpinard etpinard merged commit 28a179f into master Feb 27, 2017
@etpinard etpinard deleted the gl3d-hover-text-fixes branch February 27, 2017 17:34
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.

Hoverinfo with date axis in 3D broken when using Date objects
2 participants