【发布时间】:2022-01-07 20:12:20
【问题描述】:
有时很难弄清楚如何将 flexdashboard 用于最大目的。 由于可用的文件不多,我有时会寻求其他人的帮助。
我有如下代码所示的 flexdashboard 设计:
---
title: "My Design"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
runtime: shiny
---
```{css}
.value-box {
height: 110px;
}
```
```{r global, echo = FALSE}
library(shiny)
library(flexdashboard)
vb1 <- valueBox(value = tags$p(paste(100, "%"), style = "font-size: 140%;"),
caption = tags$p("My Value Box 1",
style = "background-color:rgba(39, 128, 227, 0.0);
border-color:rgba(39, 128, 227, 0.0);
position: absolute;
overflow: hidden;
left: 5%; top: 1px;
right: 0px;
bottom: 0px; width:100%"),
icon = "fa-thumbs-up",
color = "success" )
vb2 <- valueBox(value = tags$p(paste(50, "%"), style = "font-size: 140%;"),
caption = tags$p("My Value Box 2",
style = "background-color:rgba(39, 128, 227, 0.0);
border-color:rgba(39, 128, 227, 0.0);
position: absolute;
overflow: hidden;
left: 5%; top: 1px;
right: 0px;
bottom: 0px; width:100%"),
icon = "fa-hourglass-end", color = "danger")
vb3 <- valueBox(value = tags$p(paste(80, "%"), style = "font-size: 140%;"),
caption = tags$p("My Value Box 3",
style = "background-color:rgba(39, 128, 227, 0.0);
border-color:rgba(39, 128, 227, 0.0);
position: absolute;
overflow: hidden;
left: 5%; top: 1px;
right: 0px;
bottom: 0px; width:100%"),
icon = "fa-eur", color = "warning")
vb4 <- valueBox(value = tags$p(paste(100, "%"), style = "font-size: 140%;"),
caption = tags$p("My Value Box 4",
style = "background-color:rgba(39, 128, 227, 0.0);
border-color:rgba(39, 128, 227, 0.0);
position: absolute;
overflow: hidden;
left: 5%; top: 1px;
right: 0px;
bottom: 0px; width:100%"),
icon = "fa-clock", color = "success")
```
My Dashboard {data-icon="fa-search"}
=======================================================================
## Row {.sidebar data-width=280 data-padding=10}
```{r}
tags$h4('My Side Bar')
tags$hr()
```
Row
-----------------------------------------------------------------------
### {.value-box}
```{r}
renderValueBox(vb1)
```
### {.value-box}
```{r}
renderValueBox(vb2)
```
### {.value-box}
```{r}
renderValueBox(vb3)
```
### {.value-box}
```{r}
renderValueBox(vb4)
```
我想在数值框上添加文本框(如下图黑色部分)。
怎么做?
【问题讨论】:
标签: r shiny flexdashboard