在flexdashboard中更改字体大小/颜色/(仪表盘)

时间:2019-02-25 06:31:02

标签: r shiny shinydashboard flexdashboard

我有以下代码:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyjs)
library(shinycssloaders)
library(plotly)
library(treemap)
library(viridisLite)
library(highcharter)
library(V8)
library(dplyr)
library(RColorBrewer)
library(openxlsx)
library(quantmod)
library(shinyWidgets)
library(caret)
library(lubridate)
library(tidyr)
library(flexdashboard)


xheader<-dashboardHeaderPlus( title = "ABC")


xsidebar<- dashboardSidebar(
  sidebarUserPanel("USER",
                   subtitle = "Test",
                   image = "XXX"
  ),

  sidebarMenu(id = "left_sidebar",
              menuItem("DashBoard",
                       tabName = "ID_DashBoard",
                       icon = icon("desktop"))

  )
)

x1body<-dashboardBody(
    tabItems(
      tabItem(tabName = "ID_DashBoard",
          fluidRow(
            column(width = 4,
                   fluidRow(style = "height:1000px; background-color: #E8E9EC;font-weight:bold",
                            column(width = 4, style = "color:green;font-weight:bold;",
                                   gaugeOutput("gauge1", width = "100px", height = "200px")
                            ),
                            column(width = 4,
                                   gaugeOutput("gauge2", width = "100px", height = "200px")
                            ),
                            column(width = 4,
                                   gaugeOutput("gauge3", width = "100px", height = "200px")
                            )

                   )

            ),
            column(width = 4,
                   fluidRow("MIDDLE", style = "height:1000px; background-color: #F2F3F5;")
            ),
            column(width = 4,
                   fluidRow("RIGHT", style = "height:1000px; background-color: #E8E9EC;")
            )

          )
      )
    )
)


ui<- dashboardPagePlus(
  shinyjs::useShinyjs(),
  header = xheader,
  sidebar = xsidebar,
  body = x1body,
  skin = "black",
  sidebar_background = "light",
  collapse_sidebar = TRUE
)

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

  output$gauge1 = renderGauge({
    gauge(0.5, 
          min = 0, 
          max = 1, 
          sectors = gaugeSectors(success = c(0.5, 1), 
                                 warning = c(0.3, 0.5),
                                 danger = c(0, 0.3)),
          label = "Total Commits"
    )
  })

  output$gauge2 = renderGauge({
    gauge(0.1, 
          min = 0, 
          max = 1, 
          sectors = gaugeSectors(success = c(0.5, 1), 
                                 warning = c(0.3, 0.5),
                                 danger = c(0, 0.3)),
          label = "Total Executed"
    )
  })
  output$gauge3 = renderGauge({
    gauge(0.1, 
          min = 0, 
          max = 1, 
          sectors = gaugeSectors(success = c(0.5, 1), 
                                 warning = c(0.3, 0.5),
                                 danger = c(0, 0.3)),
          label = "Total Executed"
    )
  })


}

shinyApp(ui, server)

GUI当前如下所示: enter image description here

如您在图像中看到的,标签未正确显示在灰色背景上。我想更改以下文本的字体大小/颜色/使其变为粗体-“总计显示”,“执行总数”,“仪表显示”中的“执行总数”和仪表上的最小/最大数字。我无法通过CSS样式弄清楚。有人可以帮帮我吗?预先感谢!

0 个答案:

没有答案