2016-06-16 3 views
1

저는 이처럼 매우 기본적인 infoBox를 가지고 있으며, 현재 높이가 통합하려는 부분에 높이를 맞추기를 원합니다.반짝이는 대시 보드에서 infoBox의 높이를 조절하십시오.

어떻게 할 수 있습니까? 나는 여기에 제안 된 것을 시도했다 : r shinydashboard - change height of valueBox. 그러나 그것은 변화가 없습니다.

sidebar <- dashboardSidebar(
    sidebarMenu(id = 'sidebarmenu', 
       menuItem('About', tabName = 'about')) 
) 

about <- tabItem('about', fluidPage(
    fluidRow(
     infoBoxOutput('age') 
    ) 
) 
) 

body <- dashboardBody(
    tabItems(
    about 
) 
) 

ui <- dashboardPage(
    dashboardHeader(
    title = 'My App' 
), 
    sidebar = sidebar, 
    body = body 
) 

server <- function(input, output) { 
    output$age <- renderInfoBox({ 
    infoBox('Age: ', 50, icon = icon('list'), width = 6) 
    }) 
} 

shinyApp(ui = ui, server = server) 

답변

2

일부 CSS 규칙을 적용해야합니다.

body <- dashboardBody(
    tags$head(tags$style(HTML('.info-box {min-height: 45px;} .info-box-icon {height: 45px; line-height: 45px;} .info-box-content {padding-top: 0px; padding-bottom: 0px;}'))), 
    tabItems(
     about 
    ) 
) 
+0

매력처럼 작동합니다. 이 코드를 처리 할 필요가 없으며 대신'infoBox'에'height'라는 매개 변수가 있어야합니다. :) – Gopala

+1

'height' 또는'style = "height : 500px;"를 지원하는 몇 가지 Shiny UI 요소가 있습니다. 그러나이 경우 높이는 실제로 여러 요소 (정보 상자 및 아이콘)에 의해 결정됩니다. –

+0

@ Xiongbing Jin, 태그 $ head 명령을 주셔서 감사합니다. 제 요구 사항에도 도움이되었습니다. 약간의 조정이 필요한 링크로 도와주세요. https://stackoverflow.com/questions/47154749/changing-the-width-height-and-alignment-of-the-shiny-widgets-in-r –

관련 문제