2016-08-14 12 views
1

Я пытаюсь вставить нижний колонтитул в панель инструментов панели инструментов в нижней и центральной части страницы. Но он приходит в центр тела. Также я не могу поместить его в нижней части страницыПодравнивание нижнего колонтитула в панели инструментов блестящего приложения

Вот мой код:

library(shiny) 
library(shinydashboard) 
library(DT) 
library(ggvis) 
library(shiny) 

ui <- dashboardPage(
    dashboardHeader(title = "Dashboard"), 
    dashboardSidebar(sidebarMenu(
    menuItem("Instructions", tabName = "genIns", icon = icon("info-circle")), 
    menuItem("Data", tabName = "data", icon = icon("table")) 

)), 
    dashboardBody(
    tabItems(
     # First tab content 
     tabItem(tabName = "genIns", 
       fluidPage(
       titlePanel("General Instruction will go here")) 
    ), 
     # Second tab content 
     tabItem(tabName = "data", 
       sliderInput("bins", 
          "Number of bins:", 
          min = 1, 
          max = 50, 
          value = 30), 
       plotOutput("distPlot") 
      ) 

    ), 
    tags$footer("My footer", align = "center") 
) 
) 

server.ui

shinyServer(function(input, output, session) { 

    output$distPlot <- renderPlot({ 
    x <- faithful[, 2] # Old Faithful Geyser data 
    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 = 'darkgray', border = 'white') 
    }) 
}) 

ответ

2

Вы можете обернуть dashbordPage в tagList, а затем поместить tags$footer в второй аргумент - tagList. Вы также можете изменить стиль нижнего колонтитула с помощью css.


Полный пример:

library(shiny) 
library(shinydashboard) 
library(DT) 
library(ggvis) 
library(shiny) 

ui <- tagList(
    dashboardPage(
    dashboardHeader(title = "Dashboard"), 
    dashboardSidebar(sidebarMenu(
     menuItem("Instructions", tabName = "genIns", icon = icon("info-circle")), 
     menuItem("Data", tabName = "data", icon = icon("table")) 

    )), 
    dashboardBody(
     tabItems(
     # First tab content 
     tabItem(tabName = "genIns", 
       fluidPage(
        titlePanel("General Instruction will go here")) 
     ), 
     # Second tab content 
     tabItem(tabName = "data", 
       sliderInput("bins", 
          "Number of bins:", 
          min = 1, 
          max = 50, 
          value = 30), 
       plotOutput("distPlot") 
     ) 

    ) 

    ) 

),#end dashboardPage 
    tags$footer("My footer", align = "center", style = " 
       position:absolute; 
       bottom:0; 
       width:100%; 
       height:50px; /* Height of the footer */ 
       color: white; 
       padding: 10px; 
       background-color: black; 
       z-index: 1000;") 

)#end tagList 


server <- shinyServer(function(input, output, session) { 

    output$distPlot <- renderPlot({ 
    x <- faithful[, 2] # Old Faithful Geyser data 
    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 = 'darkgray', border = 'white') 
    }) 
}) 

shinyApp(ui, server) 
+0

мы можем поместить колонтитул над приборной панели боковой панели, а? – Rajan

+1

Конечно, это можно легко сделать, добавив 'z-index: 1000;' в стиль нижнего колонтитула. Я обновил этот пример. (Боковая панель также имеет это свойство, и она установлена ​​в 810. Мне пришлось выбрать число, большее этого) [Здесь больше о z-index] (http://www.w3schools.com/cssref/pr_pos_z-index.asp) –

+0

Я загрузил еще одну проблему, не могли бы вы мне помочь? – Rajan