Reputation: 10152
I created a shiny-app that displays values in a valueBox. The values are supposed to be displayed with the respective currency ($ or € or £), however, only the $-sign is displayed.
An MWE looks like this:
library(shinydashboard)
library(shiny)
ui <- dashboardPage(
dashboardHeader(title = "MWE"),
dashboardSidebar(),
dashboardBody(
fluidRow(
valueBox(value = paste0(sprintf("%.2f", 123.14), "$"),
subtitle = "This works good:",
color = "green"),
valueBox(value = paste0(sprintf("%.2f", 123.14), "€"),
subtitle = "This does not work:",
color = "red")
)
)
)
server <- function(input, output) {
}
shinyApp(ui, server)
Any ideas?
Upvotes: 3
Views: 3226
Reputation: 13856
Hi you could use the HTML code for € (€
or even €
) like below. And you can also use FontAwesome icons :
library(shinydashboard)
library(shiny)
ui <- dashboardPage(
dashboardHeader(title = "MWE"),
dashboardSidebar(),
dashboardBody(
fluidRow(
valueBox(value = paste0(sprintf("%.2f", 123.14), "$"), icon = icon("dollar"),
subtitle = "This works good:",
color = "green"),
valueBox(value = HTML(paste0(sprintf("%.2f", 123.14), "€")), icon = icon("euro"),
subtitle = "This does not work:",
color = "red")
)
)
)
server <- function(input, output) {
}
shinyApp(ui, server)
Upvotes: 4