Skip to content

Creating panels with various widgets, sometimes not all of them render #131

@struckma

Description

@struckma

Dear Ryan, dear Barret, dear developers of trelliscopejs,

great package, your trelliscopejs, thank you for the great idea. I've played around with it a bit, and I found

dependencies = get_dependencies(panels[[1]]),

where you exemplarily choose the first panel to define the html dependencies for a trelliscope page. However, if I use other widgets on the other panels, they won't show up, because they are missing their dependencies.

As a work-around, I could add a first dummy panel with all possible widgets on it, then everything works. I would try to fix the problem soundly by including all dependencies instead of only those for the first panel's widget, if you are interested -- I have already some prototyping work-around, but I would prefer to provide a sound fix.

Thank you,

Stephan

Code to reproduce using (trelliscopejs 0.2.6 with R version 4.3.2 (2023-10-31)):

library(tibble)
library(plotly)
library(dygraphs)
library(trelliscopejs)
library(htmltools)

tib <- tibble(.rows = 3)
tib <- tibble::add_column(tib, group = as.character(1:3))
tib <- tibble::add_column(tib,
                          result =
                            map_plot(1:3, function(i) {
                                if (i %in% c(1, 3)) {
                                  dyRangeSelector(
                                    dygraph(nhtemp, main = "New Haven Temperatures"),
                                    dateWindow = c("1920-01-01", "1960-01-01"))
                                } else {
                                  plotly::plot_ly()
                                }
                            })
)

trelliscope(tib, name = "wont render the plotly")

tib <- tibble(.rows = 3)
tib <- tibble::add_column(tib, group = as.character(1:3))
tib <- tibble::add_column(tib,
                          result =
                            map_plot(1:3, function(i) {
                              if (i %in% c(2)) {
                                dyRangeSelector(
                                  dygraph(nhtemp, main = "New Haven Temperatures"),
                                  dateWindow = c("1920-01-01", "1960-01-01"))
                              } else {
                                plotly::plot_ly()
                              }
                            })
)

trelliscope(tib, name = "wont render the dygraph")

tib <- tibble(.rows = 3)
tib <- tibble::add_column(tib, group = as.character(1:3))
tib <- tibble::add_column(tib,
                          result =
                            map_plot(1:3, function(i) {
                              dygraph(nhtemp, main = "New Haven Temperatures")
                            })
)


trelliscope(tib, name = "renders as expected")

tib <- tibble(.rows = 3)
tib <- tibble::add_column(tib, group = as.character(1:3))
tib <- tibble::add_column(tib,
                          result =
                            map_plot(1:3, function(i) {
                              plotly::plot_ly()
                            })
)

trelliscope(tib, name = "renders as expected")


tib <- tibble(.rows = 3)
tib <- tibble::add_column(tib, group = as.character(1:3))
tib <- tibble::add_column(tib,
                          result =
                            map_plot(1:3, function(i) {
                              if (i %in% c(1, 3)) {
                                dygraph(nhtemp, main = "New Haven Temperatures")
                              } else {
                                plotly::plot_ly()
                              }
                            })
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions