jbkunst / highcharter

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

Both highchartzero and highchart on the same shiny app page? #769

Closed youngyang89 closed 6 months ago

youngyang89 commented 2 years ago

Hi, I was trying to build a page with a networkgraph (the networkgraph was generated using highchartzero()%>%hc_add_dependency("modules/networkgraph.js")) and other normal highchart figures(splinerange, errorbars, etc.). All charts showed well but when I tried to interact with the network nodes, The webpage console shows the following error message and interrupts the interaction.

Uncaught TypeError: Cannot read properties of undefined (reading 'marker')
    at g.setState (highcharts.js:291:39)
    at sankey.js:11:489
    at Array.forEach (<anonymous>)
    at b.m [as setState] (sankey.js:11:434)
    at highcharts.js:472:392
    at Array.forEach (<anonymous>)
    at a.setAllPointsToState (highcharts.js:472:358)
    at a.setState (highcharts.js:472:270)
    at b.setState (<anonymous>:51:392)
    at highcharts.js:470:502

I wonder if it is caused by the conflict between highchart and hichartzero? I tried to replace my original network with the example network, it showed the same error.

UKvisits <- data.frame(
  origin = c("France", "Germany", "USA", "Irish Republic", "Netherlands", "Spain", "Italy",
             "Poland", "Belgium", "Australia",  "Other countries", rep("UK", 5)),
  visit = c(rep("UK", 11), "Scotland", "Wales", "Northern Ireland",  "England", "London"),
  weights = c(c(12,10,9,8,6,6,5,4,4,3,33)/100*31.8,  c(2.2,0.9,0.4,12.8,15.5)))

highchartzero() %>% 
  hc_add_series(
    UKvisits, 
    "networkgraph",
    hcaes(from = origin, to = visit, weight = weights),
    layoutAlgorithm = list(enableSimulation = TRUE)
    ) %>% 
  hc_add_dependency("modules/networkgraph.js")

Thanks!

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Feel free to reopen it if you find it necessary.