Plotly:如何在hoverinfo中扭曲文本

时间:2016-06-26 03:29:21

标签: r d3.js plotly

我正在尝试使用plotly来开发一个包含详细信息的gannet图表作为hoverinfo。但是,由于文本字符串的长度,hoverinfo太难阅读(如下所示)。我想知道我是否可以以某种方式包装hoverinfo以使其更具可读性。 enter image description here

以下是我提出的代码:

df = data.frame(a='High',
                info="this text doesn't mean anything and it's only here as a demonstration. You can replace this with anything else
                and I want to somehow wrap this text",
                start=as.Date("31/12/2015","%d/%m/%Y"),
                end = as.Date("31/12/2016","%d/%m/%Y"))
p = plot_ly()

p <- add_trace(p,
                 x = c(df$start[1], df$end[1]),  # x0, x1
                 y = c(1,1),  # y0, y1
                 mode = "lines",
                 line = list(color ="#FF6600", width = 20),
                 showlegend = F,
                 hoverinfo = "text",
                 text = df$info[1],
                 evaluate = T
                 #hoverinfo = "value"
)
p

0 个答案:

没有答案