Skip to content

Negate axis offset and then turn it into a string #2339

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 7 commits into from
Feb 9, 2018

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Feb 6, 2018

fixes #2338

Not 100% sure how to test this. There's probably a way to add a check in d3-strict? But maybe just a jasmine test that doesn't fail would do the trick.

cc @alexcjohnson

@etpinard etpinard added bug something broken status: reviewable labels Feb 6, 2018
@@ -328,12 +328,12 @@ proto.adjustLayout = function(ternaryLayout, graphSize) {
_this.layers.bgrid.attr('transform', bTransform);

var aTransform = 'translate(' + (x0 + w / 2) + ',' + y0 +
')rotate(30)translate(0,-' + aaxis._offset + ')';
')rotate(30)translate(0,' + -aaxis._offset + ')';
Copy link
Contributor Author

@etpinard etpinard Feb 6, 2018

Choose a reason for hiding this comment

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

When _offset is negative we use to get:

image

that is, a double - in the translate transform string.

Looks like [email protected] doesn't care, so this went unnoticed in our image tests.

@alexcjohnson
Copy link
Collaborator

Great, was hoping it would be that simple - does this fix the hover labels too?

A d3-strict test could work - if setting transform check that -- doesn't appear in the string?

@etpinard
Copy link
Contributor Author

etpinard commented Feb 6, 2018

does this fix the hover labels too?

This one is bit tricky, hovermode defaults to 'x' in plot_types.json, which isn't compatible with subplot types other than cartesian. With hovermode: 'closest', everything works fine. Now, gl3d and pie seem not to care when hovermode: 'x' is set (they behave the same as for hovemode: 'closest') whereas geo, ternary and polar hovermode: 'x' show an odd-looking arrow at the bottom of the corresponding subplots.

Clearly those odd-looking arrow need to go. But I ask: should hovermode: 'x' for subplot types without and x-axis behave like hovermode: 'closest' or like hovermode: false?

@alexcjohnson
Copy link
Collaborator

should hovermode: 'x' for subplot types without and x-axis behave like hovermode: 'closest' or like hovermode: false?

I think anything that's not explicitly hovermode: false should behave like 'closest' on subplots where compare mode doesn't make sense.

@etpinard
Copy link
Contributor Author

etpinard commented Feb 6, 2018

I think anything that's not explicitly hovermode: false should behave like 'closest' on subplots where compare mode doesn't make sense.

Sounds good. Let me fix that in this PR.

- throws errors in strict-d3 w/o latest patch in ternary.js
- note that strict-d3 does not throw in the nw.js imagetest container
  for some reason.
@etpinard
Copy link
Contributor Author

etpinard commented Feb 9, 2018

@alexcjohnson if you're looking to fix an easy (I think) bug before the 1.34.0 release, you can fixing the hovermode part of #2338 as described in #2339 (comment) . Feel free to push to this branch directly.

I have to keep working on the mapbox-gl update until Wednesday.

@@ -203,6 +205,8 @@ function _hover(gd, evt, subplot, noHoverEvent) {

var hovermode = evt.hovermode || fullLayout.hovermode;

if(hovermode && !supportsCompare) hovermode = 'closest';
Copy link
Collaborator

Choose a reason for hiding this comment

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

The second part of #2338 - fixes hover labels for geo and ternary on the plot_types mock

Copy link
Contributor Author

@etpinard etpinard Feb 9, 2018

Choose a reason for hiding this comment

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

Looks good. Not sure what's the best to 🔒 this down?

Maybe just checking that hovermode: 'x' behaves the same as hovermode: 'closest' in a cartesian + geo (or ternary or polar) graph would suffice.

Copy link
Collaborator

Choose a reason for hiding this comment

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

good call -> 16b01f0

}
addGroup(dragModeGroup);
addGroup(zoomGroup.concat(resetGroup));
addGroup(hoverGroup);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice cleanup. Looking good!

@etpinard
Copy link
Contributor Author

etpinard commented Feb 9, 2018

Nicely done 💃

@alexcjohnson
Copy link
Collaborator

Likewise, 💃 on the -- fix and d3-strict test 🎉

@alexcjohnson alexcjohnson merged commit adefca3 into master Feb 9, 2018
@alexcjohnson alexcjohnson deleted the negative-negative-translate-transform branch February 9, 2018 21:29
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.

Multi-type subplot problem
2 participants