reversable_gauge <- function(gauge_value, threshold,
label_text = '', symbol = '',
min_val = 0, max_val = 100, reversed = FALSE) {
if (reversed == FALSE) {
hi <- c(threshold+0.05, max_val)
lo <- c(min_val, threshold-0.05)
} else {
lo <- c(threshold+0.05, max_val)
hi <- c(min_val, threshold-0.05)
}
sec <- flexdashboard::gaugeSectors(success = hi,
warning = c(threshold-0.05, threshold+0.05),
danger = lo)
gauge <- flexdashboard::gauge(
gauge_value, min = min_val, max = max_val, symbol = symbol,
label = label_text, sectors = sec
)
return(gauge)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.