Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

resizing Flex dashboard gauge within a shiny app

Is there a way that i can make a flexdashboard gauge bigger in my shiny app?

I have tried to change the width and height in the UI but that just moves it around on the dashboard. It doesn't make it bigger.

library(shiny)
library(flexdashboard)

fluidRow(column(
         width =  12,
           gaugeOutput('Scale', width = "800px", height = "400px")
       )
)
like image 797
MoKG Avatar asked Mar 22 '18 13:03

MoKG


1 Answers

Do you mean something like this?

Just using some simple css.

library(shiny)
library(flexdashboard)

css <- HTML("
.html-widget.gauge svg {
  height: 400px;
  width: 800px;
}")

ui <- fluidPage(
  tags$head(tags$style(css)),
  fluidRow(column(
    width =  12,
    gaugeOutput('Scale')
  )
  )
)

server <- function(input, output, session) {
  output$Scale <- renderGauge({
    gauge(56, min = 0, max = 100, symbol = '%', label = paste("Test Label"),gaugeSectors(
      success = c(100, 6), warning = c(5,1), danger = c(0, 1), colors = c("#CC6699")
    ))
  })
}

shinyApp(ui, server)
like image 116
SeGa Avatar answered Nov 12 '22 12:11

SeGa