plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
17.06k stars 1.87k forks source link

Axis title could also change the labels in the hovering popup #2618

Closed adube closed 5 months ago

adube commented 6 years ago

This is an enhancement suggestion.

When setting the title of an axis, such as:

        xaxis: {
            type: 'linear',
            zeroline: false,
            title: "hellox"  // <----
        },

it would make sense to have the same title as default value in the popup being shown on mouse hovering. Currently, the default value stays "x", where it could have been "hellox" instead.

See an example here: https://codepen.io/anon/pen/qoGQvx

See also the riginal question asked on Stack Overflow

Please, let me know if that makes sense.

alexcjohnson commented 6 years ago

Thanks @adube - yes, makes a lot of sense. I don't think we can always do this, there are times when the title is too long, or displayed on one subplot and not others, etc... so it would probably have to be opt-in unless we can come up with a sufficiently robust criterion for automatically using the title.

adube commented 6 years ago

@alexcjohnson Thanks for your comment.

I agree. As a way to not always enable this behaviour, we could have some sort of "flag" option (boolean) which would be false by default to not break the current behaviour. When setting it to true, users could expect limitations such as title being too long and the other things you mentioned.

I'm not familiar enough with the code to be able to determine a more robust solution at this point, but I think the above suggestion could do the trick.

nicolaskruchten commented 6 years ago

I think this makes a ton of sense in general and especially in 3d and ternary contexts: 3d because after a few rotations or whatever, it's no longer visually clear what x, y, and z mean, and ternary because there's no reasonable way a user could know what A, B and C map to ;)

etpinard commented 6 years ago

Somewhat a duplicate of https://github.com/plotly/plotly.js/issues/265

adube commented 6 years ago

Indeed, it is.

vvch commented 6 years ago

I agree. As a way to not always enable this behaviour, we could have some sort of "flag" option (boolean) which would be false by default to not break the current behaviour. When setting it to true, users could expect limitations such as title being too long

This option (e.g., 'hovertitle') may also contain text (for each axis) as alternative short hover-only title for this axis. That is, default 'false' value means current behaviour, 'true' means use axis label (maybe with some automatic abbreviation), and text value means use this value. Would be great if the text may also contain HTML and TeX markup, even in 3D plots (seems like it may be simpler to implement than #608 )

vvch commented 6 years ago

Seems like similar feature was already implemented (but not pulled yet): #3126 #3007

nicolaskruchten commented 6 years ago

@antoinerg this would be a nice addition :)

gvwilson commented 5 months ago

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson