r - Shiny中的仪表板图形放置
问题描述
我的 Shiny 仪表板页面由三个主要行组成。我在前两行的图表工作正常。
但是说到第三行,我主要需要把它分成两列。然后需要将第一列分为其他列,并将我的饼图放在一个列中,将单选按钮放在另一列中。
在第二大列中,我需要放置一些信息框。我尝试放置它,以下是与我的第三行相关的部分。但这对我不起作用。有人可以帮忙吗。
fluidRow(
column(width = 8,
splitLayout(
column(width = 10,
plotOutput("PieVaccineByGender", height = "350px", width = "700px")
),
column(width = 2,
radioButtons(
"Vaccine",
"Enable or disable Grouping:",
c("Age" = "Age" ,
"Region" = "Region"),
inline = F
)
)
),
),
column(width = 4,
infoBoxOutput('VaccineCount')
)
)
以下是我的仪表板现在的样子。
解决方案
信息框显示不正确?尝试width = 12
为什么需要使用splitLayout
?您可以直接在列内添加列
见下文
library(shinydashboard)
library(shiny)
shinyApp(
ui = dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
fluidRow(
column(width = 8,
column(width = 10,
plotOutput("PieVaccineByGender", height = "350px", width = "700px")
),
column(width = 2,
radioButtons(
"Vaccine",
"Enable or disable Grouping:",
c("Age" = "Age" ,
"Region" = "Region"),
inline = F
)
)
),
column(width = 4,
shinydashboard::infoBox(title = "abc", value = "123", icon = icon("exclamation-triangle"), width = 12)
)
)
),
title = "Dashboard example"
),
server = function(input, output) { output$PieVaccineByGender <- renderPlot(plot(1))}
)
推荐阅读
- sql - SQL查询where子句如果没有匹配记录则省略
- json - 读取本地 JSON 文件并通过文本框过滤其结果
- javascript - 实现链表(数据结构)并忽略返回值
- android - 在插页式广告之前在屏幕上显示进度条
- python - “ValueError:无法识别的标记样式'hline'”。Matplotlib plot() 和 scatter() 函数无法识别一堆标记
- python - Pygame Hangman 生成新词的更简单方法?而不是制作另一个主循环
- php - 如何从 mysql 获取多个 ID 相关值
- bash - 用空格替换文本 OSX Sed
- excel - 运行时错误“1004”应用程序定义或对象定义错误
- reactjs - 谁能解释这种在javascript中一次包含两个类的方式