繁体   English   中英

如何使闪亮的应用侧边栏适合页面?

[英]How to make a shiny app sidebar fit the page?

shinyUI(

  navbarPage(inverse = TRUE, title = "Campaign Launch Demo",
             ##############Week Day insights#############################################
             tabPanel(
               # "Week Days Insights",tags$head(
               # tags$style(HTML('
               #                 #sidebar {
               #                 background-color: #4D394B;
               #                 color: #b8b0b7;
               #                 height: 90vh;
               #                 overflow-y: auto;
               #                 }
               #                 
               #                 body, label, input, button, select { 
               #                 font-family: "Arial";
               #                 }hr {border-top: 2px solid #FFFFFF;}'))
               # ),



           "Week Days Insights",tags$head(
             tags$style(HTML("hr {border-top: 1px solid #000000;}"))
           ),

           sidebarLayout(
             sidebarPanel(fluid = TRUE,width=3, 
                          # id = "sidebar", style = "position:fixed;width:inherit;",
                          # "Inputs", 
                          # tags$head(tags$style(HTML("color: violetred")),
                          # CONTROLS conditional panels
                          h3("Insights", style = "align:center;text-align:center"),

                          selectInput("Segmentation", "Please Select Segmentaion",
                                      choices=c("Daily","Hourly"),1),
                          # # option 1
                          conditionalPanel(condition = "input.Segmentation == 'Daily'",
                                           selectInput("segTypeDaily", "Select Type of Daily Segmentation",
                                                       choices=c("Per Day Revenue","Per Day Transactions"))),

                          #       # option 2
                          conditionalPanel(condition = "input.Segmentation == 'Hourly'",
                                           selectInput("segTypeHourly", "Select Type of Hourly Segmentation",
                                                       choices=c("Hourly Revenue","Hourly Transaction"))),

                          hr(),
                          h3("Marketing", style = "align:center;text-align:center"),

                          selectInput("WeekdayMarketingChoice", "Please Select Marketing Type",
                                      choices=c("Email Marketing" = "emailMarketing","SMS Marketing" = "smsMarketing"),2),


                          br(),

                          #### Condition for SMS Marketing
                          conditionalPanel(condition = "input.WeekdayMarketingChoice == 'smsMarketing'",

                                           uiOutput("dayFilterControlForSMS"),
                                           helpText("Note: SMS will be sent to all customers on selected Days"),

                                           actionButton("manualSmsCampaign", "Launch SMS Campaign", style = "align:center;text-align:center"),
                                           hr(),

                                           actionButton("maxSmsCampaign", "Campaign for Max Revenue Day"),
                                           helpText("Note: Campaigns will lauch for day with Max Revenue"),

                                           br(),
                                           actionButton("minSmsCampaign", "Campaign for Min Revenue Day"),
                                           helpText("Note: Campaigns will lauch for day with Max Revenue")

                          ),
                          # 
                          # 
                          #### Condition for Email Marketing
                          conditionalPanel(condition = "input.WeekdayMarketingChoice == 'emailMarketing'",

                                           uiOutput("dayFilterControlForEmail"),
                                           helpText("Note: Emails will be sent to all customers on selected Days"),

                                           # textAreaInput("camMessage", "Enter campaign text or offers to send: ", "Special Discount Offers!", "250px", "100px"),
                                           actionButton("manualEmailCampaign", "Launch Email Campaign", style = "align:center;background:#9966CC"),
                                           hr(),
                                           #helpText("Note: Max and Min Campaigns"),

                                           actionButton("maxEmailCampaign", "Campaign for Max Revenue Day"),
                                           helpText("Note: Campaigns will lauch for day with Max Revenue"),


                                           br(),
                                           actionButton("minEmailCampaign", "Campaign for Min Revenue Day"),
                                           helpText("Note: Campaigns will lauch for day with Min Revenue"),
                                           br()
                          )










             ),

             mainPanel(fluid = TRUE,width=9,
                       plotlyOutput('sidePlot') %>% withSpinner(color="#0dc5c1"),

                       #
                       #verbatimTextOutput("daytext") %>% withSpinner(color="#0dc5c1"),

                       br(),
                       br(),
                       br(),
                       br(),
                       hr(),
                       plotlyOutput('sidePlot2') %>% withSpinner(color="#0dc5c1")

                       # br(),
                       # br(),
                       # br(),
                       # br()
                       # 
                       #verbatimTextOutput("selectedDaysText")
                       #DT::dataTableOutput("daysDT", width = 800)

                       # plotOutput("prodgressPlot")

             )

           )
         ),
         #######################################################################




         ###############Customer Insights Tab######################################
         tabPanel("Individual Customer Insights",
                  sidebarLayout
                  ( sidebarPanel(fluid = TRUE,width=3,
                                 verbatimTextOutput("customerSidePaneltext"),
                                 actionButton("customercampaign", "Launch Personalised Campaigns")),
                    mainPanel(fluid = TRUE,width=9,
                              #DT::dataTableOutput("topcust", width = 800) %>% withSpinner(color="#0dc5c1"),
                              br(),
                              plotlyOutput('revenuePerCustomer') %>% withSpinner(color="#0dc5c1"),

                              hr(),
                              br(),
                              #plotlyOutput('transactionsPerCustomer') %>% withSpinner(color="#0dc5c1"),
                              br(),
                              br(),
                              DT::dataTableOutput("breakdownTable", width = 800) %>% withSpinner(color =
                                                                                                   "#0dc5c1"),

                              br(),
                              plotlyOutput('rfmGraphPlot') %>% withSpinner(color = "#0dc5c1"),

                              br()
                              # DT::dataTableOutput("customertext", width = 800)
                    )
                  )),
         #########################################################################

         #### Country Segmentation ####
         tabPanel("Country Centric Insights", 
                  sidebarLayout(fluid = TRUE,
                                sidebarPanel( width=3,
                                              # CONTROLS conditional panels
                                              selectInput("CountrySegmentation", "Please Select Segmentaion",
                                                          choices=c("Revenue by Country","Average Order Value over Time", "Numer of Daily Transactions"),1),
                                              uiOutput("selCountry"),


                                              br(),
                                              hr(),

                                              headerPanel("Marketing!"),
                                              uiOutput("countryControls"),
                                              helpText("Note: Emails will be sent to all customers in selected Countries"),
                                              br(),
                                              uiOutput("productControls"),
                                              # choices=c('All','Netherlands','EIRE','Germany','France','Australia'),1),
                                              helpText("Note: Discounts will be applied only on selected products"),

                                              textAreaInput("camCountryMessage", "Enter campaign text or offers to send: ", "Special Discount Offers!", "250px", "100px"),
                                              actionButton("manualCountryCampaign", "Launch Campaign"),
                                              hr()



                                ),

                                mainPanel( width=9,

                                           plotlyOutput("countryTransPlotly") %>% withSpinner(color="#0dc5c1"),
                                           br(), 
                                           plotlyOutput("countryPlotly") %>% withSpinner(color="#0dc5c1"),
                                           plotlyOutput("transactionPlotly") %>% withSpinner(color="#0dc5c1"),



                                           br(),
                                           br(),
                                           #textOutput("countryMarketingText"),
                                           verbatimTextOutput("countryText"),
                                           verbatimTextOutput("emailText"),
                                           #verbatimTextOutput("sentMail")

                                           DT::dataTableOutput("sentMail", width = 1000) %>% withSpinner(color="#0dc5c1")
                                           # verbatimTextOutput("countryText")
                                           # 

                                ))


         )



  )

)

options(shiny.error = browser)
options(warn=-1)

在此处输入图片说明 当应用程序执行时,我需要闪亮应用程序中的侧边栏以适应浏览器/小程序的大小。 目前侧边栏仅在添加输入时扩展。

您可以通过指定.well css 属性的高度并将 height 设置为屏幕的像素数来实现此目的,或者您可以设置min-height: 720px ,这应该涵盖大多数现代屏幕。 我已将其包含在navbarPage内的tags调用中

tags$style(HTML("hr {border-top: 1px solid #000000;}
                .well {height: 1200px;}"))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM