-
Notifications
You must be signed in to change notification settings - Fork 634
Open
Description
When using the %{text}
placeholder, it sometimes gets displayed instead of the actual value of text
. The following code produces a plot where, when I hover over the middle point, gives me this hover text:
Price: $6.84
X: 3
%{text}
Other points display correctly, eg.
Price: $2.03
X: 1
Text A
The code I use is a slightly modified example:
tibble::tibble(
x = c(1,2,3,4,5),
y = c(2.02825,1.63728,6.83839,4.8485,4.73463),
color = factor(c(1, 1, 2, 3, 3))) %>%
plot_ly() %>%
add_trace(
type = 'scatter', mode = 'lines+markers',
x = ~x, y = ~y, color = ~color,
text = c("Text A", "Text B", "Text C", "Text D", "Text E"),
hovertemplate = paste('<i>Price</i>: $%{y:.2f}',
'<br><b>X</b>: %{x}<br>',
'<b>%{text}</b>'),
showlegend = FALSE)
You can donwload the resulting html here (in case it renders differently for you for some reason). Note that when color is not used, this does not happen and all the points display correct hover text.
R version 3.6.3 (2020-02-29)
plotly 4.9.2.1
ppm1337cottrell
Metadata
Metadata
Assignees
Labels
No labels