Building Dashboards with shinydashboard
Png Kee Seng
Researcher
dashboardHeader()
titleWidth
argumentheader <- dashboardHeader(title = "Soccer tournament")
header <- dashboardHeader(title = "Analysis for global soccer tournament")
header <- dashboardHeader(title = "Analysis for global soccer tournament")
titleWidth = 400)
dropdownMenu()
of type
"messages"messageItem()
icon("user")
by defaulttime
header <- dashboardHeader( title = "Analysis for FIFA world cup", titleWidth = 300, dropdownMenu(type = "messages",
messageItem("Data division", "Keep up the good work!",
time = "5 mins"
)))
messageItem()
within dropdownMenu()
called "Twitter"header <- dashboardHeader( title = "Analysis for global soccer tournament", titleWidth = 400, dropdownMenu(type = "messages", messageItem("Data division", "Keep up the good work!", time = "5 mins" ),
messageItem("Twitter", "You have a Tweet!", time = "1 hour", icon=icon("twitter") ) ) )
messageItem()
notificationItem()
taskItem()
messageItem()
: Default icon is icon("user")
notificationItem()
: Default icon is icon("exclamation-triangle")
taskItem()
: Contains a progress barheader <- dashboardHeader( title = "Analysis for global soccer tournament", titleWidth = 400, dropdownMenu(type = "messages",
messageItem("Data division", "Keep up the good work!", time = "5 mins"), messageItem("Twitter", "You have a Tweet!", time = "1 hour", icon=icon("twitter")),
notificationItem("This is a notification." ),
taskItem(value = 30, color = "blue", "Dashboard construction") ))
header <- dashboardHeader( title = "Analysis for global soccer tournament", titleWidth = 400,
dropdownMenu(type = "messages", messageItem("Data division", "Keep up the good work!", time = "5 mins"), messageItem("Twitter", "You have a Tweet!", time = "1 hour", icon=icon("twitter")), notificationItem("This is a notification."), taskItem(value = 30, color = "blue", "Dashboard construction")),
dropdownMenu(type = "notifications", notificationItem(icon = icon("users"), "This is another notification." )))
dashboardSidebar()
width
.sidebarMenu()
allows us to place several pages in a shinydashboardsidebar <- dashboardSidebar()
sidebar <- dashboardSidebar(width=400)
sidebar <- dashboardSidebar(width=400,
sidebarMenu(
id = "pages",
menuItem("Many charts", tabName = "charts",
icon = icon("chart-line")),
menuItem("Statistics", icon = icon("file-excel"),
tabName = "stats")
)
)
sidebar <- dashboardSidebar(disable = TRUE)
badgeLabel
and badgeColor
sidebar <- dashboardSidebar(width=400, sidebarMenu( id = "pages", menuItem("Many charts", tabName = "charts", icon = icon("chart-line"),
badgeLabel = "New content!", badgeColor = "green"),
menuItem("Statistics", icon = icon("file-excel"), tabName = "stats",
badgeLabel = "urgent", badgeColor = "red")
) )
menuSubItem()
sidebar <- dashboardSidebar(width=400,
sidebarMenu(
id = "pages",
menuItem("Many charts", tabName = "charts",
icon = icon("chart-line"),
badgeLabel = "New content!",
badgeColor = "green"),
menuItem("Statistics", icon = icon("file-excel"),
tabName = "stats",
menuSubItem("Team 1", tabName = "team1",
icon=icon("user")),
menuSubItem("Team 2", tabName = "team2",
icon=icon("user")))
)
)
server
sidebar <- dashboardSidebar(width=400, sidebarMenu( id = "pages", menuItem("Many charts", tabName = "charts", icon = icon("chart-line"), badgeLabel = "New content!", badgeColor = "green"), menuItem("Statistics", icon = icon("file-excel"), tabName = "stats", menuSubItem("Team 1", tabName = "team1", icon=icon("user")), menuSubItem("Team 2", tabName = "team2", icon=icon("user"))),
menuItem("A couple of checkboxes", checkboxGroupInput("checkboxes", "Day of the week", choices = c("Mon","Tue","Wed","Thu","Fri","Sat","Sun"), selected = c("Mon","Tue","Wed","Thu","Fri"))) ) )
Building Dashboards with shinydashboard