rstudio / r2d3

R Interface to D3 Visualizations
https://rstudio.github.io/r2d3
Other
517 stars 103 forks source link

Data passed to multiple charts #101

Open xgebi opened 1 year ago

xgebi commented 1 year ago

May ask what is the best way to pass two different sets of data to two different charts?

From all the examples I've encountered there's only one variable with name data. Is there a way how to influence/change the name?

When I try to pass two dataset to two different charts they should not be sharing it.

(I am aware of #55 but that solution didn't work for me)

asadow commented 1 year ago

You can use two separate .js files, and send your two data frames to them. For example:

output$plot1<- renderD3({
    r2d3(df1(), "plot1.js")
  })

output$plot2<- renderD3({
    r2d3(df2(), "plot2.js")
  })