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

Collapsible box not responding in my navbarPage Rshiny #401

Open
Fredysessie opened this issue Dec 31, 2023 · 0 comments
Open

Collapsible box not responding in my navbarPage Rshiny #401

Fredysessie opened this issue Dec 31, 2023 · 0 comments

Comments

@Fredysessie
Copy link

Fredysessie commented Dec 31, 2023

I'm working on a small R Shiny application, but I'm facing an issue where the boxes aren't collapsing when I click on them. I've tried various approaches without success. Could someone assist me in resolving this?

Additionally, I'd like to know how to customize the appearance of these boxes.

Here is a minimal example:

library(shinydashboard)
library(DT)
library(highcharter)
library(shinyjs)
library(shinythemes)  

# I using getSymbols to retrieve data
the_data <- getSymbols("AAPL", src = "yahoo", from = "2018-11-07", to = Sys.Date(), auto.assign = FALSE)
# The keep only the "Adjusted Close" as time serie
Prix_de_cloture <- Cl(the_data)

#My UI part
ui <- fluidPage(
  titlePanel(""),
  navbarPage(
    "Clusters de Volatilité",
    header = tagList(
      useShinydashboard()
    ),
    inverse = TRUE,
    theme = shinytheme("cerulean"),
    shinyjs::useShinyjs(),
    shinyjs::inlineCSS(
      ".main-sidebar { background-color: #f8f9fa; }"
    ),
    tabPanel("Analyses primaires",
             sidebarLayout(
               sidebarPanel(align = "center",
                            selectInput("ticker", "Choisir un Ticker :", c("AAPL", "MSFT", "GOOGL", "AMZN")),
                            dateRangeInput("date", strong("Choisir les dates"),
                                           start = "2020-01-06", end = (Sys.Date()-1))
               ),
               mainPanel(
                 fluidRow(
                   # DT Table
                   box(title = "Comparizon table",
                       status = "primary",
                       solidHeader = TRUE,
                       collapsible = TRUE,
                       DTOutput("Comparizontable"),
                       width = 12,
                       height = 'auto'),
                   br(), br(),

                   # Highchart
                   box(title = "Closing price chart",
                       status = "primary",
                       solidHeader = TRUE,
                       collapsible = TRUE,
                       highchartOutput("closing_price"),
                       width = 12,
                       height = 'auto')
                 )
               )
             )
    )
  ))

server <- function(input, output) {
  output$Comparizontable <- renderDataTable({
    info.mat <- structure(c(9.342, 9.354, 9.342, 9.347, 9.344, 9.36, 9.344, 9.35,
                            9.349, 9.369, 9.349, 9.356, 9.37, 9.39, 9.37, 9.378, 9.345, 9.365,
                            9.345, 9.353), dim = 4:5, dimnames = list(c("Akaike", "Bayes",
                                                                        "Shibata", "Hannan-Quinn"), c("Arch(1,1)", "GARCH(1,1)", "TGARCH(1,1)",
                                                                                                      "EGARCH(1,1)", "GJR-GARCH(1,1)")))
    datatable(info.mat, escape = FALSE)
  })

  output$closing_price <- renderHighchart({
    # Trying to plot the graph
    hchart(the_data)
  })
}

# Run the application
shinyApp(ui, server)

image

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