Open dholford opened 3 years ago
Does it work with a different color, e.g. "danger"
or "primary"
?
No, I've tried different colors in different boxes and haven't been able to get any of them to work.
I also tried valueBoxOutput(), as that was one of the things I found in my searching, but that led to a whole slew of other errors.
On a traditional Shiny app, you would assign the renderValueBox()
to an object in the server.R
file and you would call it for display in valueBoxOutput()
in the ui.R
file. However, the Markdown-esque approach used with package flexdashboard
defenestrates that.
Since I'm far more familiar with Shiny apps this is a bit difficult to diagnose. Please email me your script and I'll take a look.
Pro tip: try to work the sentence, “the Markdown-esque approach used with package flexdashboard defenestrates that” into job interviews whenever possible. :-)
@dholford strangely, this is because the valueBox()
label must be done outside the code chunk using Markdown subtitle formatting with ###
, and this must be done for each value box.
Row
-------------------------------------
### Test 1
```{r}
renderValueBox({
d7 <- sum.injury.dat %>%
filter(Collisionmanner == input$Collision)
A.Rate <- round(d7$P.accidents,1)
valueBox(A.Rate,
icon = "fa-car-crash",
color = "warning")
})
renderValueBox({
d7 <- sum.injury.dat %>%
filter(Collisionmanner == input$Collision)
I.Rate <- round(d7$P.injury,1)
valueBox(I.Rate,
icon = "fa-briefcase-medical",
color = "danger")
})
renderValueBox({
d7 <- sum.injury.dat %>%
filter(Collisionmanner == input$Collision)
Rate.Difference <- round((d7$P.accidents - d7$P.injury),1)
valueBox(Rate.Difference,
icon = "fa-calculator",
color = ifelse(test = Rate.Difference < 0,
yes = "danger",
no = "primary"))
})
![image](https://user-images.githubusercontent.com/15643196/128761949-75d70d34-3859-4866-b4a0-c5a137831aba.png)
Got it! Thank you!
I was able to replicate it on my end.
So I've been trying to get some value boxes on one of my tabs to highlight a few of the statistics shown on the graph.
I've been able to get the graphs side by side underneath where the value boxes will go, and I've been able to get the values to show up. However, none of the formatting (color, icon, or an actual box) is showing up. As pictured below (this is showing all three value box values, I have the code for the first value box below):
Here is the code:
`Row