r - Shinydashboard 的问题 - dashboardSidebar 和 dashboardBody
问题描述
我是 Shiny 和 Shinydashboard 的新手。请考虑以下代码片段(大量代码的一小部分):
dbsidebar <- dashboardSidebar(
sidebarMenu(
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
menuItem("Rank List", icon = icon("th"), tabName = "Widgets1", badgeColor = "green"),
menuItem("Build Your", icon = icon("th"), tabName = "Widgets2", badgeColor = "green"),
menuItem("Groups", icon = icon("th"), tabName = "Widgets3", badgeColor = "green")
)
)
dbBody <- dashboardBody(
tabItems(
tabItem(tabName = "dashboard",
fluidRow(
#Pie Charts
splitLayout(
#cellWidths = c("50%", "50%"),
style = "border: 1px solid silver;",
cellWidths = 450,
cellArgs = list(style = "padding: 6px"),
plotlyOutput("Piechart1", width = "400px", height = "200px"),
plotlyOutput("Piechart2", width = "400px", height = "200px"),
plotlyOutput("Piechart3", width = "400px", height = "200px")
)
)
),
tabItem(tabName = "Widgets1",
#Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("TCScore","TCScore:",min = 0, max = 100, value = c(0,100))
),
# Show a plot of the generated distribution
mainPanel(
tabPanel("Heading", plotlyOutput("tbTable"))
)
),
downloadButton('downloadData', 'Download')
),
tabItem(tabName = "Widgets2", "XX"
# #Data Table
# sidebarLayout(
# sidebarPanel(
# sliderInput("TCCScore","TCCScore:",min = 0, max = 100, value = c(0,100)),
# ),
#
# # Show a plot of the generated distribution
# mainPanel(
# tabPanel("Heading", dataTableOutput("tbTable1"))
# )
#
# ),
# downloadButton('downloadData', 'Download')
),
tabItem(tabName = "Widgets3", "third"
)
)
)
在dashboardSidebar 上,我添加了4 个选项卡-dashboard、Widget1、Widget2、Widget3。最初对于这些选项卡中的每一个,我使用简单的文本来呈现 UI dashboardBody,并且我得到了正确的显示。我开始填写这些部分中的每一个 - “仪表板”、“Widget1”,并且显示对我来说正常工作。不幸的是,对于“Widget2 - 当我删除“XX”并取消注释上面显示的代码时,UI 完全扭曲了。看起来dashboardBody 中的主要 UI 元素没有被渲染?谁能告诉我我做错了什么? 请帮忙。很抱歉我没有发布完整的工作代码,但它太长了,因此我只需要发布一个小代码片段。
提前致谢!欢呼!
解决方案
推荐阅读
- node.js - dockerode,如何使容器中运行的进程独立于节点进程?
- java - Spring Boot Maven 集成测试给出 ClassNotFoundException
- c# - 如何从作为对象的选定 ListItem 中获取电子邮件
- linux - 如何在 Linux 上为 gstreamer 安装 video.h?
- android - 如何在 Android 工具栏中为标题添加阴影?
- java - 我想在我的 cardview+RecyclerView 中显示 Title、Description 和 Price,而它只显示 Title
- python-3.x - 计算特定时间段的列值
- linux - rsync 与 chmod 到远程目标不会允许文件权限
- php - Don't don't why the image quality is not 100%
- scala - 将 EitherT[Future, A, Future[B]] 转换为 EitherT[Future, A, B]