Ana5
1
Hi,
I have two valueBoxes and I want to change their size and I used width to do that as you can see in the code below:
Highlight 2 {.value-box}
renderValueBox({
rate <- input$omissos
valueBox(
value = rate,
width = 5,
color = if (rate <= 50) "primary" else "warning",
caption = "% de dados omissos"
)
})
Highlight 2 {.value-box}
renderValueBox({
valueBox(
"Métodos aplicados:",
"Casos Completos; Imputação pela média; Imputação pela mediana;
LOCF; NOCB; Imputação Múltipla",
width = 7,
color = "success")
})
However, it does not work:
How can I do that since I want the left one to be smaller than the right one?
Thanks!
I think the trick is to define it in the valueBoxOutput rather than the valueBox, not sure why.
library(shiny)
library(shinydashboard)
body <- dashboardBody(
fluidPage(
fluidRow(
sliderInput("omissos",
label = "Rate",
value=49,
min = 0,
max=100)
),
# valueBoxes
fluidRow(
shinydashboard::valueBoxOutput("box1",width=5),
shinydashboard::valueBoxOutput("box2",width=7)
)
))
server <- function(input, output) {
output$box1<-renderValueBox({
rate <- req(input$omissos)
valueBox(
value = rate,
color = if (rate <= 50) "blue" else "yellow",
subtitle = "% de dados omissos"
)
})
output$box2<-renderValueBox({
valueBox(
"Métodos aplicados:",
"Casos Completos; Imputação pela média; Imputação pela mediana;
LOCF; NOCB; Imputação Múltipla",
color = "green")
})
}
shinyApp(
ui = dashboardPage(
dashboardHeader(),
dashboardSidebar(),
body
),
server = server
)
1 Like
system
Closed
3
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.