Good afternoon All :),
I have a little problem with a tooltip within a highchart on a Rshiny chart. I reproduced the problem in a simplified example, requiring 'highchart' and 'shiny' librairies. Here is the code :
library("shiny")
library("highcharter")
data(citytemp)
ui <- fluidPage(
h1("Highcharter EXAMPLE"),
fluidRow(
column(width = 8,
highchartOutput("hcontainer",height = "500px")
)
)
)
server = function(input, output) {
data = data[,c("month","tokyo","new_york")]
output$hcontainer <- renderHighchart({
hc <- highchart() %>%
hc_chart(type = "line") %>%
hc_title(text = "Monthly Average Temperature for TOKYO") %>%
hc_subtitle(text = "Source: WorldClimate.com") %>%
hc_xAxis(categories = c('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')) %>%
hc_yAxis(title = list(text = "Temperature (C)")) %>%
hc_tooltip(pointFormat = '<span style="color:{series.color}">As for NY: </span>:
<b>{point.percentage:.1f}%</b> ({point.y:,.0f} millions)<br/>',
followPointer=TRUE,
shared = TRUE)%>%
hc_plotOptions(line = list(
dataLabels = list(enabled = TRUE),
enableMouseTracking = FALSE)
) %>%
hc_series(
list(
name = "Tokyo",
data = data$tokyo))
hc
})
}
shinyApp(ui = ui, server = server)
I have a problem with the tooltip, I cannot understand why it does not work ? It does not appear on the app while launched. Also, I would like the tooltip to contain the data from another series (here New york) - is that feasible or the tooltip can only refer to the line on the chart ? thank you very much for your help ! All the best, madzia