I'm having trouble recreating this answer in R with Highcharter to make the bars in a bar chart into clickable URLs. Here is the Javascript code from the answer. Highcharter has a vignette about recreating Javascript that I tried to follow. Here's what tried so far. It doesn't show any of the bars.
library(tidyverse)
library(highcharter)
highchart() %>%
hc_chart(type = "column") %>%
hc_title(text = "Click points to go to URL") %>%
hc_xAxis(type = "category") %>%
hc_plotOptions(series = list(cursor = "pointer"),
point =
list(events = list(
click = JS(
"function () {
location.href = 'https://en.wikipedia.org/wiki/' +
this.options.key;
}"
)
))) %>%
hc_series(
list(name = "USA", key = "United_States", y = 29.9),
list(name = "Canada", key = "Canada", y = 71.5),
list(name = "Mexico", key = "Mexico", y = 106.4)
)
See Question&Answers more detail:os