Comments (4)
That should already be possible.
from shinydashboard.
Is this the syntax for instance? It doesnt work for me
sidebarMenu(
menuItem("A", tabName = "a", icon = icon("group", lib="font-awesome"))
,menuItem("B", tabName = "b", icon = icon("check-circle", lib = "font-awesome"))
,menuItem("C", tabName = "c", icon = icon("coffee", lib = "font-awesome"))
,helpText("hello!")
)
from shinydashboard.
You're right, that didn't work right before - the content had to go outside of the sidebarMenu. I've made it more tolerant in aac931c. Here's an example app that shows how to place content in a number of different places.
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
sidebarMenu(id = "sidebarmenu",
menuItem("A", tabName = "a", icon = icon("group", lib="font-awesome")),
menuItem("B", tabName = "b", icon = icon("check-circle", lib = "font-awesome")),
sliderInput("b", "Under sidebarMenu", 1, 100, 50),
menuItem("Sub-items C",
sliderInput("c1", "Under menuItem 1", 1, 100, 50),
sliderInput("c2", "Under menuItem 2", 1, 100, 50)
)
),
sliderInput("x", "Outside of menu", 1, 100, 50)
),
dashboardBody()
)
server <- function(input, output) {}
shinyApp(ui, server)
from shinydashboard.
Hi
Hope this is the correct spot for this.
I'm working on a ShinyDashboard with input in sidebarMenu / MenuItem. Content comes up perfectly but cannot get it to connect with dashboardBody. Large plot (output$Sum1) detailed below works perfectly when input is within dashboardBody.
Any help would be greatly appreciated.
JW
library(shiny)
library(shinydashboard)
library(shinythemes)
library(shinyWidgets)
library(dplyr)
library(tidyverse)
library(readxl)
library(writexl)
library(formattable)
library(DT)
library(zoo)
library(lubridate)
library(plotly)
library(shinycssloaders)
library(shinydashboardPlus)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
sidebarMenu(id="tabs",
menuItem("Load Summary", tabName = "LoadS", icon = icon("dashboard"),
selectInput(inputId = "SQD",
label = "Select Squad",
choice = c("Senior", "Academy")),
selectInput(inputId = "LoadSum",
label = "Load Summary",
choice = c("Distance", "AvgSpeed", "HSR", "Sprints", "COD_Load")))
dashboardBody(tabItems(
tabItem(tabName = "LoadS",
fluidRow(
box(plotlyOutput("Sum1", height = 400) %>% withSpinner(color="#0dc5c1")
)#box
)#fluidRow
),#tabItem
)#dashboardBody
)#tabItems
)#dashboardPage
server <- function(input, output) {
output$Sum1 <- renderPlotly({
SQ1 <- input$SQD
VAR <- input$LoadSum
TG3 <- RG3 %>% filter(Squad == SQ1) %>%
filter(Type == "All Session") %>%
filter(Variable == VAR)
TG4 <- TG3 %>% group_by(Date) %>%
summarize(Avg_Var = mean(Data),
Var_sd = sd(Data)) %>%
mutate(Event = "Training") %>%
mutate_if(is.numeric, round, digits = 2)
###########################################################
#Summarize Game
GA1 <- RG3 %>% filter(Type == "Game") %>%
filter(Squad == SQ1) %>%
filter(Variable == VAR)
GA2 <- GA1 %>% group_by(Name, Date) %>%
summarize(Sum_Var = sum(Data))
Date <- GA2 %>% pull(Date)
Variable <- GA2 %>% pull(Sum_Var)
BI <- bind_cols(Date, Variable) %>%
rename(Date = c(1), Variable = c(2))
BI2 <- BI %>% group_by(Date) %>%
summarize(Avg_Var = mean(Variable),
Var_sd = sd(Variable)) %>%
mutate(Event = "Game") %>%
mutate_if(is.numeric, round, digits = 2)
############################################################
#Full data set + add TSB Variables
FD <- bind_rows(BI2, TG4)
GF <- FD %>% filter(Date >= as.Date("2020-12-04") & Date <= as.Date("2020-12-16"))
GFa <- GF %>% mutate(Avg_Var = Avg_Var - Avg_Var) %>%
mutate(Var_sd = Var_sd - Var_sd)
FG <- FD %>% filter(Date <= as.Date("2020-12-04") | Date > as.Date("2020-12-16"))
FD <- bind_rows(GFa, FG)
FD2 <- FD %>% arrange(Date) %>%
mutate(A_Load = zoo::rollmean(Avg_Var, k = 7, fill = NA, align = "right"),
C_Load = zoo::rollmean(Avg_Var, k = 28, fill = NA, align = "right")) %>%
mutate(TSB = A_Load / C_Load) %>%
mutate(Date = as.Date(Date)) %>%
mutate_if(is.numeric, round, digits = 2)
############################################################
p <- ggplot(FD2, aes(Date, Avg_Var, label = Event)) +
geom_smooth(method = 'loess', alpha = 0.1, show.legend = FALSE, fill = "lightsteelblue", colour = "grey99", span = 0.3) +
geom_point(size=2.5, shape=21, colour = "slategrey", fill="slategrey") +
geom_point(data=subset(FD2, Event == "Game"), color = "red", fill = "red") +
geom_errorbar(aes(ymin=Avg_Var-Var_sd, ymax=Avg_Var+Var_sd), width=.2,
position=position_dodge(0.05), alpha = 0.4)+
geom_line(aes(y = A_Load), color = "green", size = 1.2, alpha =0.5) +
geom_line(aes(y = C_Load), color = "blue", size = 1.2, alpha =0.3) +
theme_classic()
fig <- ggplotly(p)
fig
})}
shinyApp(ui, server)
from shinydashboard.
Related Issues (20)
- can not see my second tabitem after clicking action button HOT 1
- Error with publication of a Shiny App with R
- [Update request] The default icon for menuSubItem() "angle-double-right" is now "angles-right" in Font Awesome 6.0.0 HOT 5
- dynamic footer HOT 6
- FYI copyright on the shinydashboard website HOT 1
- dashboardPage shouldn't create <title> HTML tags if title = NULL HOT 1
- dashboardBody not showing when conditionalPanel is used HOT 1
- Toggling boxes to collapse has unexpected results with nested boxes HOT 1
- ShinyDash fails to render since R4.3 added to computer. HOT 3
- `shinydashboard::updateTabItems` not matching `shiny::updateTabsetPanel` HOT 2
- Why use unsecure AdminLTE? HOT 4
- Remove/hide footer from dashboard HOT 3
- Collapsible box not responding in my navbarPage Rshiny
- shinydashboard - "Get started" Tab [1 Link + 1 Typo] HOT 1
- shinydashboard - "Appearance" Tab [1 Punctuation]
- shinydashboard - "Behavior" Tab [1 Typo]
- I am using the R Package shinydashboard, now the dashboardSidebar is NOT showing in black background HOT 8
- `updateTabItems` not working when selecting dynamically rendered `menuSubItem` HOT 2
- sidebar id is not in input inside a RMarkdown HOT 3
- Mention this package is not meant to be used in conjunction with {bslib}
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shinydashboard.