plotly / plotly/plotly.R

hovertemplate doesn't work for points in boxplots

未关闭
#1,636 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug plotly.js
主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用 boxpoints 和 hovertemplate 重现两个 R 示例中的 boxplot,然后将它们与正常工作的条形图示例进行比较。从浏览器错误中显示的 hovertemplateString 调用开始,跟踪 boxplot 点的悬停路径;当 hovertemplate 能够在 boxplot 数据点上渲染且不再出现 t.replace 错误时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, r
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。