【发布时间】:2021-01-13 12:57:09
【问题描述】:
我已经构建了一个闪亮的仪表板,其中一部分将允许人们生成与其地理区域相关的图表。区域将作为 selectInput 列在侧栏中,并在图表上绘制区域,但是,如果他们选择英格兰,我希望它具有不同的美感,尤其是更粗的线,以便突出。所有其他区域的厚度应相同,但颜色仍应不同,以便区分。我觉得我错过了一些非常明显的东西!
dashboardHeader(title = "Dashboard"
),
dashboardSidebar(
sidebarMenu(id = "sidebarid",
menuItem("Graphs", tabName = "graphs", icon = icon("chart-line")),
conditionalPanel(
'input.sidebarid == "graphs"',
selectInput("area", "Area",
c("England", "Bolton","Bury","Manchester","Oldham", "Rochdale", "Salford","Stockport","Tameside","Trafford","Wigan"),
multiple = T, selected = "Manchester")
)
)
),
dashboardBody(
## Maps Tab, core dashboard
tabItem(
tabName = "graphs",
fluidRow(
width = "100%",
plotOutput("chart"),
)
)
)
)
server <-
function(input,output, session){
area <- reactive({
NCMPRec_time %>% filter(AreaName %in% input$area)
})
output$chart <- renderPlot({
ggplot(area(), aes(x=Timeperiod, y=Value, group = AreaName)) +
geom_line(aes(color = AreaName)) +
geom_point(aes(color = AreaName)) +
labs(x = "Time", y = "Percent", col="Area") +
theme_classic() +
scale_colour_branded()
})
}
shinyApp(ui, server)
【问题讨论】: