Plotly.js: HoverInfo is truncated with long variable names

Created on 21 Apr 2016  路  10Comments  路  Source: plotly/plotly.js

There doesn't appear to be a way to specify the hoverinfo width. With longer variable names the strings are truncated with ellipses. I haven't tried any of the samples for providing custom hoverinfo text since I'm using the R API and overriding event handlers is not supported (as far as I can tell).

Duplicate on StackOverflow:
http://stackoverflow.com/questions/36207887/plot-ly-hover-box-size-attribute

It would be nice if the desired tooltip dimensions could be specified.

Most helpful comment

adding hoverlabel: {namelength :-1} into my trace object did the trick.

All 10 comments

There doesn't appear to be a way to specify the hoverinfo width.

Not at the moment.

Here's a workaround: http://codepen.io/etpinard/pen/LNJmeM

I think this is not a solution. I would like the text to be same in legend and in hover tooltip. now in your workaround you have trace1, trace2 in legend which is not so informative.

I have to put the same information into text, and into name of trace to achive this, but then in tooltip information is displayed twice.

image

@nothinkelse you can set the trace hoverinfo to x+y+text (instead of the default x+y+text+name) to remove the trace name from the hover labels.

This is still not very satisfying. I know it seems minor, but from a stylistic standpoint, it's much nicer to be able to use the separation of styling between the number shown and the label. This is automatic with hovertext=name, but the unfortunately truncation happens. Hovertext=text works to display the full label, however, the styling is less satisfying (causes an extra tall hovertext box, no separation between number and label making it harder for the eyes to quickly parse). Furthermore, as others have pointed out, you may want to display separate information in the text field from the name field and display both without truncation: https://community.plot.ly/t/re-size-hover-info-box/955/2

Since the hovertext boxes can already be really wide to accommodate long text fields, why not just allow name fields to also grow the width of the hovertext box in a similar manner? It could even be a simple flag: truncatename: true/false, with true as default so as not to change current default behavior.

It could even be a simple flag: truncatename: true/false, with true as default so as not to change current default behavior.

If you feel like making a PR, go for it :rocket:

I am currently having the same problem and the workaround is not doing it for me. This is my plot

image

If I were to change hoverinfo to "text" and change the text to include the name of the trace, then the trace name will appear inside the bar along with the numbers like so.

image

Is there a workaround for this?

Same issue here

I think this is not a solution. I would like the text to be same in legend and in hover tooltip. now in your workaround you have trace1, trace2 in legend which is not so informative.

I have to put the same information into text, and into name of trace to achive this, but then in tooltip information is displayed twice.

image

try using using hoverlabel = dict(namelength = -1) instead

example:

line = dict(type='scatter',
                x = x_vector,
                y = y_vector,
                mode = 'lines+markers',
                name = base.columns[i],
                hoverlabel = dict(namelength = -1)
               )

screenshot 2018-10-04 13 44 59

adding hoverlabel: {namelength :-1} into my trace object did the trick.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxwell8888 picture maxwell8888  路  3Comments

empet picture empet  路  3Comments

etpinard picture etpinard  路  3Comments

pynklu picture pynklu  路  3Comments

nicolaskruchten picture nicolaskruchten  路  3Comments