Units in texthover

Hi,

I’m trying to have units after the y value in the texthover tooltip, so I tried

var data = [{
x: my_x_data,
y: my_y_data,
type: ‘scatter’,
text: ’ unit’,
hoverinfo: ‘y+text’
}];

but unsuccessfully, because it shows the unit after a line break.

If someone have an idea…
Thanks a lot!

You’re looking for

Yes!!! ticksuffix!
Thanks a lot!

Ok, ticksuffix is actually used to set the suffix for the ticks numbers. It has a consequence on the number shown in the hover tooltip, but in my case, I want only the suffix in the tooltip, not for ticks numbers.
So I found valuesuffix, but it works only for table.
I will try this: https://stackoverflow.com/questions/41926407/plot-ly-simple-prefix-or-suffix-for-hover-text?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
Thanks again!

You’re looking for https://plot.ly/javascript/reference/#layout-yaxis-showticksuffix then.

Thanks for your reply.
I tried this, but with showticksuffix: none, the suffix disappear in the tooltip too.

I have the same problem. ticksuffix + showticksuffix: “none” should exactly create the desired behaviour (by simple logic) but it doesn’t.

First, I’m seeing the same behavior as the above, ‘none’ should give the desired behavior but doesn’t. I will note that in my case using ‘first’ or ‘last’ is at least closer to the goal. It shows the suffix on the axes still but only on one point, and the hover text includes the text in that case. This is my temporary (if still not correct) solution noted here for others who also find this.