jbkunst / highcharter

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

Highchart proxy not working on server #745

Closed lakshyaduhan closed 2 years ago

lakshyaduhan commented 2 years ago

Hi,

I am trying to create some highcharts and update them with proxy. The code is perfectly working when i run it in Rstudio but doesnt work when i deploy the code on server. The highchart proxy is declared under observeEvent when it wait for user to update values and then display chart accordingly. When i include highcharts proxy code, all the charts disappears but if i comment out all the highchart proxy code, the static charts remain but doesn't update (which is obvious since we don't have any proxy).

highcharter package - 0.9.3.9000

Anyone having this issue recently?

jbkunst commented 2 years ago

Hi @lakshyaduhan

Can you get some logs: server and browser?

lakshyaduhan commented 2 years ago

Hi @jbkunst

Please see the attached file for logs, if thats the one you were after. Let me know if you need further information.

logs.txt

jbkunst commented 2 years ago

I don't see anything weird. What about the browser?

image

(https://kb.mailster.co/how-can-i-open-the-browsers-console/)

lakshyaduhan commented 2 years ago

Browser console does show chart undefined whereas that's not the case. console-log.txt

jbkunst commented 2 years ago

Nothing I can see. Do you have a link?

lakshyaduhan commented 2 years ago

Here is the server link: The Employment scenario should have a chart something like the image shared and when update industry the chart should update, but when we add the proxy code the chart just disappears. It works fine over Rstudio and local machine, but doesnt on server. image

https://remplan.shinyapps.io/wyndham_beta/

jbkunst commented 2 years ago

Can you put a button to update the series instead of doing automatically? I would try to:

  1. First generate the chart.
  2. When the chart is ready use a button observeEvent(input$an_action_button) to update the chart
lakshyaduhan commented 2 years ago

Thanks @jbkunst for the suggestion. I will do some testing to confirm if it works.

Also, I am trying to update the charts (mentioned in above comment), where we have to remove 'area range' series and then add them back to have the latest values in 'area range', is there any efficient and better way to update charts without removing and adding them back.

I am not able to update 'area range' using hcpxy_update_series, the chart keeps the old value for some reason whereas central value is updated easily.

Here is the code example which we are currently doing but wanted to improve this:

highchartProxy("Employment Chart") %>%
          hcpxy_remove_series(
            id = "inner"
          ) %>%
          hcpxy_remove_series(
            id = "outer"
          ) %>%
            hcpxy_add_series(
              data = Data %>% rename("low" = `90%_lower`, "high" = `90%_upper`),
              id = "outer",
              name = "outer",
              type = "arearange",
              color = cols[4],
              fillOpacity = 0.3,
              lineWidth = 0
            ) %>%
            hcpxy_add_series(
              data = Data %>% rename("low" = `50%_lower`, "high" = `50%_upper`),
              id = "inner",
              name = "inner",
              type = "arearange",
              color = cols[4],
              fillOpacity = 0.3,
              lineWidth = 0
            ) %>%
            hcpxy_update_series(
              data = Data %>% pull(central),
              id = "central"
            )