Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run app after editing #252

Open
jennAllen opened this issue Nov 21, 2023 · 0 comments
Open

Unable to run app after editing #252

jennAllen opened this issue Nov 21, 2023 · 0 comments

Comments

@jennAllen
Copy link

During the QA bug bash I used the default Geyser template as my starting point. I removed the original plot item in the upper right and added a couple of other UI elements. After I stopped the editor and attempted to run the App, I got an error:

=> Shutting down running shiny app... 
> runApp('~/Desktop/bug_bash')
Error in card_header("Settings") : could not find function "card_header"

This is what my app looked like in the editor:
Screenshot 2023-11-21 at 2 14 30 PM

And here is the app.R code:

library(shiny)
library(plotly)
library(gridlayout)
library(bslib)
library(DT)


ui <- grid_page(
  layout = c(
    "header  header header",
    "sidebar area4  area5 ",
    "table   table  plotly",
    "table   table  plotly"
  ),
  row_sizes = c(
    "40px",
    "0.83fr",
    "1.17fr",
    "1fr"
  ),
  col_sizes = c(
    "250px",
    "1.13fr",
    "0.87fr"
  ),
  gap_size = "1rem",
  grid_card(
    area = "sidebar",
    card_header("Settings"),
    card_body(
      sliderInput(
        inputId = "bins",
        label = "Number of Bins",
        min = 12,
        max = 100,
        value = 30,
        width = "100%"
      ),
      numericInput(
        inputId = "numRows",
        label = "Number of table rows",
        value = 10,
        min = 1,
        step = 1,
        width = "100%"
      )
    )
  ),
  grid_card_text(
    area = "header",
    content = "GEYSER - TEST APP",
    alignment = "center",
    is_title = TRUE
  ),
  grid_card(
    area = "table",
    card_header(
      "Table",
      selectInput(
        inputId = "mySelectInput",
        label = "Select Input",
        choices = list("Option A" = "A", "Option B" = "B", "Option C" = "C")
      )
    ),
    card_body(DTOutput(outputId = "myTable", width = "100%"))
  ),
  grid_card(
    area = "plotly",
    card_header("Interactive Plot"),
    card_body(
      plotlyOutput(
        outputId = "distPlot",
        width = "100%",
        height = "100%"
      )
    )
  ),
  grid_card(
    area = "area4",
    card_body(
      radioButtons(
        inputId = "myRadioButtons",
        label = "Radio Buttons",
        choices = list(
          "choice a" = "a",
          "choice b" = "b",
          "Value3" = "value3",
          "Value4" = "value4",
          "Value5" = "value5",
          "Value6" = "value6"
        ),
        width = "100%"
      )
    )
  ),
  grid_card(
    area = "area5",
    card_body(textOutput(outputId = "textOutput"))
  )
)


server <- function(input, output) {
   
  output$distPlot <- renderPlotly({
    # generate bins based on input$bins from ui.R
    plot_ly(x = ~ faithful[, 2], type = "histogram")
  })
  
  output$bluePlot <- renderPlot({
    # generate bins based on input$bins from ui.R
    x <- faithful[, 2]
    bins <- seq(min(x), max(x), length.out = input$bins + 1)
  
    # draw the histogram with the specified number of bins
    hist(x, breaks = bins, col = "purple", border = "white")
  })
  
  
}

shinyApp(ui, server)
  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant