-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
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: We should make sure that all axes (cartesian, 3d, ternary, polar and maybe geo and mapbox) support this new attribute. |
There's also the possibility of implementing |
@@ -593,6 +593,15 @@ module.exports = { | |||
'*%H~%M~%S.%2f* would display *09~15~23.46*' | |||
].join(' ') | |||
}, | |||
hovertitle: { | |||
valType: 'boolean', |
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.
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).
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.
The hovertitle
is now a string
instead of a boolean
.
Other axis types have _hovertitle
attribute. Wondering if we should change them to hovertitle
?
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.
Sounds like those _hovertitle
are now obsolete. Would you mind 🔪 ing them? Thanks!
src/components/fx/hover.js
Outdated
@@ -25,6 +25,8 @@ var Registry = require('../../registry'); | |||
var helpers = require('./helpers'); | |||
var constants = require('./constants'); | |||
|
|||
var MAJOR_VERSION = 1; // i.e. Plotly version |
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.
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], |
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.
Why did you patch this mock?
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 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: '', |
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.
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.
src/plots/cartesian/axis_defaults.js
Outdated
if(axType !== 'category' && !options.noHover) coerce('hoverformat'); | ||
if(axType !== 'category' && !options.noHover) { | ||
coerce('hoverformat'); | ||
coerce('hovertitle'); |
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.
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.
Now in #3498 |
Fix #2618 and #265
A new attribute
hovertitle
could be applied with each axis to enable this feature.@plotly/plotly_js