Simple flexdashboard icons size/ functionality issue

Hello,

I've been researching about the use of Icons in flexdashboards and I tried to replicate what I found on:
https://rmarkdown.rstudio.com/flexdashboard/using.html#value_boxes

Here is the rmarkdown script:

---
title: "Row Orientation"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
---


```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
libs <- c("shiny","tidyverse",
          "lubridate","shinydashboard", "flexdashboard")
lapply(libs, require, character.only = TRUE)
rm(libs)
```


Row 
-----------------------------------------------------------------------

### Contact Rate

```{r, echo = FALSE}
rate <- 78
gauge(rate, min = 0, max = 100, symbol = '%', gaugeSectors(
  success = c(80, 100), warning = c(40, 79), danger = c(0, 39)
))
```

### Average Rating 

```{r, echo = FALSE}
rating <- 35
gauge(rating, min = 0, max = 50, gaugeSectors(
  success = c(41, 50), warning = c(21, 40), danger = c(0, 20)
))
```

### Cancellations

```{r, echo = FALSE}
cancellations <- 8
gauge(cancellations, min = 0, max = 10, gaugeSectors(
  success = c(0, 2), warning = c(3, 6), danger = c(7, 10)
))
```

Row
-----------------------------------------------------------------------

### Articles per Day

```{r, echo= TRUE}
articles <- as.numeric(6436)
valueBox(articles, icon = "fa-pencil")
```

### Comments per Day

```{r, echo= TRUE}
comments <- as.numeric(1234)
valueBox(comments, icon = "fa-comments")
```

### Spam per Day

```{r, echo= TRUE}
spam <- as.numeric(6373)
valueBox(spam, 
         icon = "fa-trash",
         color = ifelse(spam > 10, "warning", "primary"))
```

The second row with the icons are not rendering the actual number and the size is completely off, although basically the same as website, just placed numbers to variables to populate the icons.

Any idea why this is?

Ty.

I think you need to set echo = FALSE for every chunk with a flexdashboard, so that it renders correctly.
Here the box shows the code because you set echo = TRUE, but the box is too small. If you set echo to FALSE, you got a correct result

1 Like

I'm a moron... Did not notice that, sorry!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.