Hey everyone!
This is my first question in this community, so please forgive me if it isn't asked in the correct way. I would love to learn how to add a tooltip to a gauge in a shiny dashboard I'm building.
For context, I'm working on a diversity dashboard for my team, and we have a couple gauges that show the proportion of the team that is LGBTQIA and neurodivergent.
I'd love to add a tooltip to be able to provide more information about what each term means. Here is the code for the gauges.
Thanks so much! I'm a big fan of this community - keep doing what you're doing!
Row
-----------------------------------------------------------------------
### LGBTQIA
```{r}
selected_data <- reactive({
if (input$role_type == "All Roles") {
df
} else {
filter(df, role_type == input$role_type)
}
})
renderGauge({
# calculate percent LGBTQIA
rate <- sum(selected_data()$lgbtqia == "Yes") / nrow(selected_data())
rate <- coalesce(round(rate * 100, 1), 0)
# build gauge
gauge(rate, min = 0, max = 100, symbol = '%', gaugeSectors(success = c(0, 100)),
href = 'https://lgbtqia.ucdavis.edu/educated/glossary.html')
})
```
### Neurodivergent
```{r}
selected_data <- reactive({
if (input$role_type == "All Roles") {
df
} else {
filter(df, role_type == input$role_type)
}
})
renderGauge({
# calculate percent LGBTQIA
rate <- sum(selected_data()$neurodivergent == "Yes") / nrow(selected_data())
rate <- coalesce(round(rate * 100, 1), 0)
# build gauge
gauge(rate, min = 0, max = 100, symbol = '%', gaugeSectors(success = c(0, 100)))
})
```