2016-03-24 20 views
3

私はuin.Rを書くためにライブラリshinydashboardを使用しています。(R shiny)はinfoBoxの幅を変更できません

fluidRow(infoBoxOutput("dri")) 

をそして、私のserver.Rに、私が書いた:私のdashboardBodyの一部では、私が書いた

output$dri = renderInfoBox({ 
    infoBox(
     width = 2, 
     title = tags$b("Score"), 
     value = tags$b("100"), 
     color = "aqua", 
     fill = TRUE, 
     icon = icon("edit") 
    ) 
})* 

しかし、幅が2に変更されません。それでもデフォルトの1、つまり4(ウェブページの全幅の1/3)が使用されます。 誰かがこれを手伝ってくれますか?どうもありがとうございました!

+0

が列ベースまたは行ベースのレイアウトで、あなたの 'infoBox'ですできます? – SymbolixAU

答えて

4

たぶん、あなたはstyleそれ自身

rm(list = ls()) 
library(shiny) 
library(shinydashboard) 

ui <- dashboardPage(
    dashboardHeader(), 
    dashboardSidebar(), 
    dashboardBody(fluidRow(infoBoxOutput("dri")),tags$style("#dri {width:200px;}")) 
) 

server <- function(input, output) { 
    output$dri <- renderInfoBox({ 
    infoBox(
     title = tags$b("Score"), 
     value = tags$b("100"), 
     color = "aqua", 
     fill = TRUE, 
     icon = icon("edit") 
    )  
    }) 
} 
shinyApp(ui, server) 

200ピクセル enter image description here

1000px enter image description here

+0

@Pork Chopありがとうございます。それは今完璧に動作します! –

+1

@ XinWang http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work –

関連する問題