我正在尝试生成单个时间线的精简视图,以便我可以将其中的许多内容放在一个页面上。为了最大化没有标签的内容交付(允许推送更多点),我想在点上使用颜色编码来指示事件类型。我将样式列添加到我的数据框中,但它影响的只是标签。如何影响点本身的颜色
我调查了生成的 HTML,发现样式被附加到包含点和文本的元素的定义中,但似乎文本有它自己的样式:
<div class="vis-item vis-point vis-readonly" style="border-color: red; color: red; left: 343.741px; top: 5px;">
<div style="margin-left: 16px;" class="vis-item-content">point1</div>
<div style="top: 11px; left: 4px;" class="vis-item vis-dot vis-readonly"></div>
</div>
重现代码:
data = data.frame (
content = c ("point1", "point2", "point3"),
start = c ("2010-03-28", "2012-01-17", "2013-12-15"),
end = c ("2010-03-28", "2012-01-17", "2013-12-15"),
type = c ("point", "point", "point"),
style = c ("border-color: red; color: red;", "border-color: blue; color: blue", "border-color: red; color: red;"))
ui <- fluidPage(
timevisOutput("timeline")
)
server <- function (input, output, session) {
output$timeline <- renderTimevis ({
timevis (data = data, options = list(stack = FALSE))
})
}
shinyApp(ui = ui, server = server)
如何影响每点的颜色?