闪亮/闪亮仪表板中的图标

时间:2019-05-21 13:11:14

标签: r shiny shinydashboard

我的客户希望我创建一个包含以下图标的shinydashboard

enter image description here

有人知道类似的图标吗

shiny / shinydashboard中的任何允许我将数字放在圆圈中间的东西?

1 个答案:

答案 0 :(得分:1)

如果只是图标,您会在这里找到它:

https://fontawesome.com/icons/circle?style=regular

但是,如果您想在内部显示一个数字,则可以使用纯CSS来实现。

library(shiny)

ui <- fluidPage(

   titlePanel("Circle"),

   sidebarLayout(
      sidebarPanel(
          includeCSS("www/style.css"),
         sliderInput("bins",
                     "Number of bins:",
                     min = 1,
                     max = 50,
                     value = 30)
      ),

      # Show a plot of the generated distribution
      mainPanel(
         tags$div(id="insidediv", textOutput("slideroutput"))
      )
   )
)

# Define server logic required to draw a histogram
server <- function(input, output) {

    output$slideroutput <- renderText({
        input$bins
    })
}

# Run the application 
shinyApp(ui = ui, server = server)

CSS文件:

#insidediv {
    background-color:#fff;
    border:4.5px solid grey;    
    height:100px;
    border-radius:50%;
    -moz-border-radius:50%;
    -webkit-border-radius:50%;
    width:100px;
}

#slideroutput {
    padding-top: 30px;
    padding-bottom: 30px;
    text-align: center;
    font-weight: bold;
    font-size: 24px;
}

enter image description here