dreamRs / esquisse

RStudio add-in to make plots interactively with ggplot2
https://dreamrs.github.io/esquisse
Other
1.76k stars 228 forks source link

Cannot reset esquisse module in RShiny app #120

Open sarthi2395 opened 4 years ago

sarthi2395 commented 4 years ago

I tried playing around with the app here where I can run esquisse module in a shiny app and dynamically select the data to be visualized. First, I try to create a set of sample visualizations with the default iris data set, set the plot type to line and update color to yellow. Now if I select the second data set, the plot type still remains Line and the plot color Yellow. When only when I drag and drop the axes variables from the newly loaded data set, this seems to reset.

Image1 Image2

Is there a way to reset the entire module without calling it again in the server? Am I missing something here?

whakaoo commented 3 years ago

Dear All, Following the question as I have a similar issue here. Dynamically populated callModule using within a function and creating in Shiny the dynamic graph using: callModule(module = esquisserServer, id = "esquisse", data = data_r) with data_r a reactiveValues with data and name

I can see the list of all variables according to different datasets (e.g. iris, mtcars and others). During the first selection made using selectizeInput everything works fine while if I change the dataset ---> I drag and drop the first variable and is ok and as I drag and drop the second variable I get the following error: Warning: Error in FUN: object 'variable2' not found. It seems that, as the reactive content is updated with the new dataset (in fact printing data_r$data and data_r$ name I get the new dataset but the esquisserServer is still pointing to previous reactive content (that is expired) and it crash (or maybe the callModule should be called once even the dataset is changing?)

Moreover, in the displayed esquisse graph I have an annoying appearing and disappearing x and y scrollbars (stopping only if I click pause). Maybe is likely due to the communication between server and client due to reactive content...I don't know but if someone know how to disable it. it would be very good (already tried to insert the esquisse_ui code in a div with overflow: hidden but is not working).

Any suggestion is really appreciated, thanks. Kind regards,

taknotts commented 3 years ago

Hello dreamrs- I think I have the same problem as @whakaoo. In the context of a shiny app using esquisse_server, if I make a change to the data input, the dragula options change reflecting the new data but when I pull the new variable into the graph, it crashes the app with the error in FUN: object not found error. Any guidance would be appreciated. Thank you for a wonderful tool.

Kawalia commented 2 years ago

Hi, I am also having same problem mentioned by @taknotts @whakaoo. Is anyone working on this issue ? Fixing of this one is really helpful. Thanks !

whakaoo commented 2 years ago

Dear @Kawalia and @taknotts , you have to play around the way you create your reactive data variables in the server side and, therefore, how reactive content is passed to the callModule. Probably, the original problem is due to the fact that Shiny initiates variables not in the right time as we expect. So you have to check if reactive data variables are initiated and updated correctly before CallModule. I did several attempts but finally I solved all the problems and now the code is working fine. Kind regards,

Kawalia commented 2 years ago

Thanks @whakaoo , I also tried same after reading your coment and now my code is also working, However, I still feel it should be fixed here since esquisse_server is getting updated data but its not communicated further.

taknotts commented 2 years ago

I also made revisions to my code and it works fine now.