jbkunst / highcharter

R wrapper for highcharts
http://jkunst.com/highcharter/
Other
717 stars 147 forks source link

modules/accessibility.js not working #792

Closed GregorDeCillia closed 1 year ago

GregorDeCillia commented 1 year ago

Thank you for this wonderful package.

I currently have issues getting the accessibility module to work. For some reason, the module can be used with highchartzero() but not with highchart()

library(highcharter)
my_data <- data.frame(x = 1:100, y = cumsum(rnorm(100)))

# works
highchartzero() %>% 
  hc_add_series(my_data) %>% 
  hc_add_dependency("modules/accessibility.js")

# data is not shown
highchart() %>% 
  hc_add_series(my_data) %>% 
  hc_add_dependency("modules/accessibility.js")

With highchart(), the js console shows the followig error

accessibility.js:99 Uncaught TypeError: Cannot read properties of undefined (reading 'enabled')
  this.chart.options.accessibility.enabled && b ...

I tried do do some hacking via the unexported .hc_opt() function, but this only leads to another error

highchart() %>% 
  hc_add_series(my_data) %>% 
  hc_add_dependency("modules/accessibility.js") %>%
  highcharter:::.hc_opt("accessibility", enabled = TRUE)
#> accessibility.js:190 Uncaught TypeError: Cannot read properties of undefined (reading 'pointDescriptionEnabledThreshold')

I am able to reproduce this with the current dev version (b53834c3b7e71e03741cd68b1c3595e75b0e79ef) and with the version from CRAN. I currently have a fairly large codebase built on top of highchart() and rewriting everything to use highchartzero() seems very unattractive.

GregorDeCillia commented 1 year ago

I just saw that there are already some similar issues #755 #778 as well as a pr in #780. Closing duplicate