hoverinfo doesn't work with hoveron 'fill'
In v4.7.1.9000, hoverinfo = 'text' doesn't work when hoveron = 'fill'. That is, trace name is displayed instead of the text value.
p <- plot_ly() %>%
add_trace(
type = "scatter",
mode = "lines",
x = c(0,1,1,0,0),
y = c(0,0,1,1,0),
fill = "tonext",
fillcolor = "blue",
hoveron = "fills",
hoverinfo = "text",
text = "testing"
)
It works as expected in JS https://codepen.io/bcd/pen/vjQvvo
Huh, this appears to work for me with both fill or fills (using efe5535). Could you try updating and confirm?
devtools::install_github('ropensci/plotly')
It works! Didn't update recently 🙄
hoverinfo can have different values like x, y or text. But it seems only text info is shown on hover. Don't know why. Should this issue still be closed?
Using hoveron = "fills" gives me a very different result than hoveron = "fill" (while tooltip = "text" and hoverinfo = "text") With hoveron = "fills" I get some of the values in the text aesthetic that I want (but it's buggy - the tooltip text is a long list instead of a specific entry) With hoveron = "fill", I get the names of "fill" aesthetic instead.
I wanted to point out my fill aesthetic is discrete factors (5) and I seem to get only 5 distinct tooltips only, instead of an individual tooltip for every shape in my geom_sf.
This SO question describes our problems with tooltips on maps with ggplotly: https://stackoverflow.com/questions/59310051/r-ggplotly-shows-wrong-tooltip-with-geom-sf-and-discrete-fill-scale