add url to hc_vistime chart

Viewed 18

I would like to add the ability to click on imbedded hyperlinks in my floating bar chart created using hc_vistime. Using Hyperlink bar chart in Highcharter, I can activate the link, but it navigates to "file not found". Below is my code.

df1<-data.frame(event=c("store","home","school"),
                group=c("john","steve","john"),
                start=c(as.POSIXct("2022-9-15"),as.POSIXct("2022-9-16"),as.POSIXct("2022-9-17")),
                end=c(as.POSIXct("2022-9-15"),as.POSIXct("2022-9-16"),as.POSIXct("2022-9-17")),
                color=c("#D3D3D3","#81ccfe","#D3D3D3"),
                url=c("https://www.google.com/","https://www.bing.com/","https://www.msn.com/"))

a<- hc_vistime(df1, optimize_y = T, col.group = "group", show_labels = TRUE)%>%
  hc_plotOptions(
    series = list(
      cursor = "pointer",
      point = list(
        events = list(
          click = JS( "function () { location.href = this.df1$url; }")))))
a

I am confused on how to appropriately link the location.ref command to df1, given the difference in coding structure between vistime and "normal" bar charts. Thank you in advance.

0 Answers
Related