-
Notifications
You must be signed in to change notification settings - Fork 636
Open
Description
Hello plotly.R,
I'm using the hovertemplate in a bar chart with my data segmented using the color argument. I wish to use the text value in my hovertemplate.
The issue is that the template is not processed for one of my two segments.
Run the below code, and hover on the three bars. For the first two, the hover info is correct, for the last one, it shows the template part where the text is supposed to go.
Note 1: replacing text with y works in this case. But there could be a case where I really need the text and not the y.
Note 2: the texttemplate does not have this issue and correctly shows the value of the text in all three bars.
library(plotly)
df <- data.frame(year = c('2021', '2020', '2019'), value = c(123, 110, 95))
plot_ly(data = df, x=~year, y=~value, text=~value, type='bar', color=~(year=='2021'),
textposition = 'outside', texttemplate = '%{text:.2s}',
hovertemplate = paste('Year: %{x}', '<br>Value: %{text:.4s}<br><extra></extra>'))Metadata
Metadata
Assignees
Labels
No labels