Skip to content

Axis labels could be applied in the hovering popup #3317

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

Closed
wants to merge 12 commits into from
Closed

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Dec 10, 2018

Fix #2618 and #265
A new attribute hovertitle could be applied with each axis to enable this feature.
@plotly/plotly_js

@etpinard
Copy link
Contributor

Hmm. I think I would prefer an "opt-in" version - at least in v1.x as some might consider this a breaking change.

To do so, I propose adding a new attribute to add axes the support hover called: 'hovertitle' and use that in fx/hover.js like you did here.

We should make sure that all axes (cartesian, 3d, ternary, polar and maybe geo and mapbox) support this new attribute.

@antoinerg
Copy link
Contributor

There's also the possibility of implementing hovertemplate for 3D.

@archmoj archmoj changed the title Axis labels applied in the hovering popup Axis labels could be applied in the hovering popup Dec 12, 2018
@etpinard etpinard added this to the 1.44.0 milestone Dec 21, 2018
@@ -593,6 +593,15 @@ module.exports = {
'*%H~%M~%S.%2f* would display *09~15~23.46*'
].join(' ')
},
hovertitle: {
valType: 'boolean',
Copy link
Contributor

Choose a reason for hiding this comment

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

That's not what I had in mind.

I was thinking of making hovertitle a string that defaults to the current behavior (in v1.x, and potentially default to the axis title value in v2.x).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The hovertitle is now a string instead of a boolean.
Other axis types have _hovertitle attribute. Wondering if we should change them to hovertitle?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds like those _hovertitle are now obsolete. Would you mind 🔪 ing them? Thanks!

@@ -25,6 +25,8 @@ var Registry = require('../../registry');
var helpers = require('./helpers');
var constants = require('./constants');

var MAJOR_VERSION = 1; // i.e. Plotly version
Copy link
Contributor

Choose a reason for hiding this comment

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

Nop. Please don't include version-specific logic. Write code for v1.x, we'll patch this up in a v2 branch when we get there.

@@ -2,28 +2,59 @@
"data": [
{
"type": "heatmap",
"x": [0, 1, 2],
"y": [0, 1, 2],
"x": [0, 1, 2, 3, 4],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you patch this mock?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a new mock added quite recently. I thought we could expand a bit to allow interactivelytesting hovertitle on gl3d & gl2d.

@@ -593,6 +593,15 @@ module.exports = {
'*%H~%M~%S.%2f* would display *09~15~23.46*'
].join(' ')
},
hovertitle: {
valType: 'string',
dflt: '',
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this line. The hovertitle default isn't blank. As it depends on which axis where coercing, we can't declare a default value here, so the best thing we can do is to not declare any default value.

if(axType !== 'category' && !options.noHover) coerce('hoverformat');
if(axType !== 'category' && !options.noHover) {
coerce('hoverformat');
coerce('hovertitle');
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we give this a default value? By implementing something like:

coerce('hovertitle', options.dfltHoverTitle);

Each handleAxisDefaults caller would have to pass another options key, but this would make the chart editor devs (aka RCE) much happier (as the default value will be automatically filled in the RCE panels) and the logic in Fx.hover simpler.

@etpinard
Copy link
Contributor

Dropping from 1.44.0.

I'd like @archmoj to focus on #3438

@archmoj
Copy link
Contributor Author

archmoj commented Jan 30, 2019

Now in #3498

@archmoj archmoj closed this Jan 30, 2019
@etpinard etpinard deleted the issue-2618 branch February 12, 2019 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants