更改 Flexdashboard 中值框的高度
Change height of valueboxes in Flexdashboard
我正在制作一个以列为导向的 Flexdashboard,它包含四个值框以及图形和表格。值框之前有一定的高度,但我最近更改了其中一个值框的信息,现在所有框的高度都更大了。以下是代码查找四个值框的方式
vb1<-valueBox(Parkvorgaenge_Insgesamt,"Parkvorgänge Insgesamt", icon = "fa-car", color = "warning")
vb2<-valueBox(Parkstunden_Insgesamt,"Parkstunden Insgesamt", icon = "fa-hourglass-end", color = "warning")
vb3<-valueBox(Einnahmen_Insgesamt,"Einnahmen Insgesamt", icon = "fa-eur", color = "warning")
vb4<-valueBox(Durchschnittliche_Parkdauer,"Durchschnittliche Parkdauer", icon = "fa-clock", color = "warning")
Column {data-width=350}
-----------------------------------------------------------------------
###
``{r}
renderValueBox(vb1)
``
###
``{r}
renderValueBox(vb2)
``
###
``{r}
renderValueBox(vb3)
``
###
``{r}
renderValueBox(vb4)
``
我尝试在三个主题标签中添加 {data-height = some number}
(例如 ### {data-height = some number}),但这并没有改变高度。我在网上看过,但没有直接回答这个问题。
简而言之,在Flexdashboard中如何控制值框的高度?
您可以使用 css 更改值框的高度:
---
title: "Tabset Column"
output:
flexdashboard::flex_dashboard
runtime: shiny
---
```{css}
.value-box {
height: 200px;
}
```
```{r global, echo = FALSE}
library(shiny)
library(flexdashboard)
vb1<-valueBox(2000,"Parkvorgänge Insgesamt", icon = "fa-car", color = "warning")
vb2<-valueBox(541515,"Parkstunden Insgesamt", icon = "fa-hourglass-end", color = "warning")
vb3<-valueBox(30000,"Einnahmen Insgesamt", icon = "fa-eur", color = "warning")
vb4<-valueBox(5.4,"Durchschnittliche Parkdauer", icon = "fa-clock", color = "warning")
```
Column
-----------------------------------------------------------------------
###
```{r}
renderValueBox(vb1)
```
###
```{r}
renderValueBox(vb2)
```
###
```{r}
renderValueBox(vb3)
```
###
```{r}
renderValueBox(vb4)
```
或者您可以将 css 放在一个单独的文件中。在下面的示例中,它被称为 styles.css
并且与应用程序位于同一文件夹中。
.value-box {
height: 200px;
}
这将是应用程序本身:
---
title: "Tabset Column"
output:
flexdashboard::flex_dashboard:
css: styles.css
runtime: shiny
---
```{r global, echo = FALSE}
library(shiny)
library(flexdashboard)
vb1<-valueBox(2000,"Parkvorgänge Insgesamt", icon = "fa-car", color = "warning")
vb2<-valueBox(541515,"Parkstunden Insgesamt", icon = "fa-hourglass-end", color = "warning")
vb3<-valueBox(30000,"Einnahmen Insgesamt", icon = "fa-eur", color = "warning")
vb4<-valueBox(5.4,"Durchschnittliche Parkdauer", icon = "fa-clock", color = "warning")
```
Column
-----------------------------------------------------------------------
###
```{r}
renderValueBox(vb1)
```
###
```{r}
renderValueBox(vb2)
```
###
```{r}
renderValueBox(vb3)
```
###
```{r}
renderValueBox(vb4)
```
我正在制作一个以列为导向的 Flexdashboard,它包含四个值框以及图形和表格。值框之前有一定的高度,但我最近更改了其中一个值框的信息,现在所有框的高度都更大了。以下是代码查找四个值框的方式
vb1<-valueBox(Parkvorgaenge_Insgesamt,"Parkvorgänge Insgesamt", icon = "fa-car", color = "warning")
vb2<-valueBox(Parkstunden_Insgesamt,"Parkstunden Insgesamt", icon = "fa-hourglass-end", color = "warning")
vb3<-valueBox(Einnahmen_Insgesamt,"Einnahmen Insgesamt", icon = "fa-eur", color = "warning")
vb4<-valueBox(Durchschnittliche_Parkdauer,"Durchschnittliche Parkdauer", icon = "fa-clock", color = "warning")
Column {data-width=350}
-----------------------------------------------------------------------
###
``{r}
renderValueBox(vb1)
``
###
``{r}
renderValueBox(vb2)
``
###
``{r}
renderValueBox(vb3)
``
###
``{r}
renderValueBox(vb4)
``
我尝试在三个主题标签中添加 {data-height = some number}
(例如 ### {data-height = some number}),但这并没有改变高度。我在网上看过,但没有直接回答这个问题。
简而言之,在Flexdashboard中如何控制值框的高度?
您可以使用 css 更改值框的高度:
---
title: "Tabset Column"
output:
flexdashboard::flex_dashboard
runtime: shiny
---
```{css}
.value-box {
height: 200px;
}
```
```{r global, echo = FALSE}
library(shiny)
library(flexdashboard)
vb1<-valueBox(2000,"Parkvorgänge Insgesamt", icon = "fa-car", color = "warning")
vb2<-valueBox(541515,"Parkstunden Insgesamt", icon = "fa-hourglass-end", color = "warning")
vb3<-valueBox(30000,"Einnahmen Insgesamt", icon = "fa-eur", color = "warning")
vb4<-valueBox(5.4,"Durchschnittliche Parkdauer", icon = "fa-clock", color = "warning")
```
Column
-----------------------------------------------------------------------
###
```{r}
renderValueBox(vb1)
```
###
```{r}
renderValueBox(vb2)
```
###
```{r}
renderValueBox(vb3)
```
###
```{r}
renderValueBox(vb4)
```
或者您可以将 css 放在一个单独的文件中。在下面的示例中,它被称为 styles.css
并且与应用程序位于同一文件夹中。
.value-box {
height: 200px;
}
这将是应用程序本身:
---
title: "Tabset Column"
output:
flexdashboard::flex_dashboard:
css: styles.css
runtime: shiny
---
```{r global, echo = FALSE}
library(shiny)
library(flexdashboard)
vb1<-valueBox(2000,"Parkvorgänge Insgesamt", icon = "fa-car", color = "warning")
vb2<-valueBox(541515,"Parkstunden Insgesamt", icon = "fa-hourglass-end", color = "warning")
vb3<-valueBox(30000,"Einnahmen Insgesamt", icon = "fa-eur", color = "warning")
vb4<-valueBox(5.4,"Durchschnittliche Parkdauer", icon = "fa-clock", color = "warning")
```
Column
-----------------------------------------------------------------------
###
```{r}
renderValueBox(vb1)
```
###
```{r}
renderValueBox(vb2)
```
###
```{r}
renderValueBox(vb3)
```
###
```{r}
renderValueBox(vb4)
```