hovertemplate doesn't work for points in boxplots
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
Using hovertemplate on a boxplot breaks the tooltips for data points, it simply doesn't appear at all:

# Using hoverinfo (works)
plot_ly() %>% add_trace(y = 1:10, type = "box", hoverinfo = "y", boxpoints = "all", pointpos = 0)
# Using hovertemplate (doesn't work)
plot_ly() %>% add_trace(y = 1:10, type = "box", hovertemplate = "%{y}", boxpoints = "all", pointpos = 0)
When inspecting the hovertemplate graph using my browser's dev tools I found that this appears in the console when I move the mouse over a data point:
test2.html:1820 Uncaught TypeError: t.replace is not a function
at Object.l.hovertemplateString (test2.html:1820)
at SVGGElement.<anonymous> (test2.html:1820)
at test2.html:1820
at ut (test2.html:1820)
at Array.W.each (test2.html:1820)
at A (test2.html:1820)
at test2.html:1820
at test2.html:1820
at l (test2.html:1820)
at Object.r.throttle (test2.html:1820)
hovertemplate works as expected for other graph types, like e.g.:
plot_ly() %>% add_trace(y = 1:10, type = "bar", hovertemplate = "%{y}")
plotly 4.9.0
R 3.4.4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two R examples with a boxplot using boxpoints and hovertemplate, then compare them with the working bar example. Start at the hovertemplateString call shown in the browser error and trace the boxplot point-hover path; done means hovertemplate renders for boxplot data points without the t.replace error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100