Description Usage Arguments Value Examples
This piece of code is necessary so that plots get the good background color, automatically. It requires the use of the thematic package and shiny dev.
1 | useAutoColor(input, output, session)
|
input |
Shiny input object. |
output |
Shiny output object. |
session |
Shiny session object. |
An observer telling Shiny to update the current theme. It has to be inserted at the top of the main server function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | if (interactive()) {
library(shiny)
library(bs4Dash)
library(thematic)
thematic_shiny()
shinyApp(
ui = dashboardPage(
header = dashboardHeader(
title = bs4DashBrand(
title = "My dashboard",
color = "primary",
href = "https://adminlte.io/themes/v3",
image = "https://adminlte.io/themes/v3/dist/img/AdminLTELogo.png"
)
),
sidebar = dashboardSidebar(),
body = dashboardBody(
sliderInput("obs", "Number of observations:",
min = 0, max = 1000, value = 500
),
plotOutput("distPlot")
),
controlbar = dashboardControlbar(),
title = "DashboardPage"
),
server = function(input, output, session) {
useAutoColor()
output$distPlot <- renderPlot({
hist(rnorm(input$obs))
})
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.