upsetjs / upsetjs_r

😠 htmlwidget R bindings for UpSet.js for rendering UpSet plots, Euler, and Venn Diagrams
https://upset.js.org/integrations/r
Other
36 stars 2 forks source link

Integrate crosstalk without shiny #47

Open g-pires opened 3 months ago

g-pires commented 3 months ago

Hi,

Is there a way to integrate the upsets and venns with crosstalk without using shiny ? But rather using a classic Rmd like does plotly for example.

Thanks !

sgratzl commented 3 months ago

can you provide a plot.ly example to understand what you mean?

g-pires commented 2 months ago

Hi,

Of course, here is a reproducible example :

df <- data.frame(x = letters[1:20], y = runif(20))

shared_df <- crosstalk::SharedData$new(df)

f <- crosstalk::filter_select("id", "Select an x", shared_df, ~x)

p <- plotly::plot_ly(data = shared_df, 
                              x = ~x, 
                              y = ~y, 
                              type = "scatter", 
                              mode = "markers")

t <- reactable::reactable(shared_df)

crosstalk::bscols(f, p, t)

In this simple example, one can update the table AND the plot at the same time using the filter_select from crosstalk without using any shiny

sgratzl commented 2 months ago

so far filtered data is not supported via crosstalk since it would require to recompute the intersections.

the following crosstalk handler is registered: https://github.com/upsetjs/upsetjs_r/blob/972b8d4da3a36fa198a79e40014fc57d19aec1fa/js/htmlwidget.ts#L26