Skip to content

hovertemplate doesn't work for points in boxplots #1636

Open
@Komposten

Description

@Komposten

Using hovertemplate on a boxplot breaks the tooltips for data points, it simply doesn't appear at all:

image

# 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions