Reputation: 1
I have a data set like the one shown in the link. Basically, there are 2 columns, one is Date and another Value.
How can I create a sparkline in Shiny with tooltip showing both date and value? I found an example given in this link:
output$sparkBox <- renderValueBox({
tags$div(class = "col-sm-4",
tags$div(class = "small-box bg-aqua",
tags$div(class = "inner",
h3(data[3]),
p("Best Price")),
tags$div(class = "spark",
sparkline:::sparklineOutput("sprk", 150, 80),
sparkline:::sparkline(outputid = "sprk",
values = data,
tooltipFormat = '${{y}}',
width = 150, height = 80)
)))
})
When I plot value as the sparkline, how can I add date value into the tooltipFormat field? e.g. "2016-10: 1234"
Appreciate for any suggestion.
Upvotes: 0
Views: 933
Reputation: 13680
Maybe a bit late, but I just found out about sparkline
sparkline(outputid = "sprk",
values = data,
tooltipFormat = '{{x}}: ${{y}}',
width = 150, height = 80)
should do the trick
Upvotes: 1