【发布时间】:2017-03-14 05:41:40
【问题描述】:
我正在构建一个 RShiny 应用程序,并且遇到了一个感觉应该有答案的问题。这是我闪亮的应用程序当前 ui 代码的一个版本,以及它的输出屏幕截图。
ui = fluidPage(theme = shinytheme('simplex'),
fluidRow(
column(width = 12, align = 'left',
h2('NBA Shot Chart and Movement Tracking Application'),
h5('Using the interface below, you can create beautiful shot charts and movement tracking visualizations
of NBA players, for specific games or across entire NBA seasons'),
br()
)
),
####################################################################################
fluidRow(
column(width = 4, align = 'center',
h3('Shot Chart Parameters'),
hr())
),
fluidRow(
column(width = 2, align = 'center',
# Input for player to look up.
selectInput(inputId = 'shooter.input', label = 'Select Shooter:', multiple = FALSE, choices = shooter.selection,
width = '100%', selected = 'Stephen Curry'),
# Input for season.
selectInput(inputId = 'season.input', label = 'Select Season:', multiple = FALSE, choices = season.selection,
width = '100%', selected = '2015')),
column(width = 2, align = 'center',
# Input for opponent to look up.
selectInput(inputId = 'opponent.input', label = 'Select Opponent:', multiple = FALSE, choices = team.selection,
width = '100%', selected = 'ALL'),
# Input for other shot chart filters.
selectInput(inputId = 'filter.input', label = 'Select Filter:', multiple = FALSE, choices = filter.selection,
width = '100%', selected = 'ALL')
)
),
fluidRow(
# action button to update graphics
column(width = 1.33, align = 'center',
actionButton(inputId = 'update.chart', label = 'Reset Shot Chart')),
# action button to toggle to shot charts
column(width = 1.33, align = 'center',
actionButton(inputId = 'toggle.shotchart', label = 'Launch Shot Chart')),
# action button to toggle to movement tracking charts
column(width = 1.33, align = 'center',
actionButton(inputId = 'toggle.movement', label = 'Launch Motion Tracking'))
),
fluidRow(
column(width = 4, align = 'center',
# moving the table into this panel here now
h3('Complete Shooter Profile'),
hr(),
h4('Shooting by Location'),
dataTableOutput('shot.table')
)
)
)
下面是输出的截图:
但是,我当前的 ui 代码的结构方式导致我的应用程序的其余部分出现问题。首先,非常令人沮丧的是,在一个流畅的行中,我需要创建 2 列,每列宽度为 2,以便在 2x2 网格中显示 4 个 selectInput。其次,对 3 个 actionButtons 使用 3 列,每列宽度为 1.33 不起作用。第三,可能也是最重要的,创建大量的fluidRows(而不是1个fluidRow,我可以在其中包裹按钮(这是我想要的!))不允许我在右手边添加我的图闪亮的应用程序的一侧,而不会弄乱左侧的格式。
以前有没有人遇到过这个问题,并且熟悉比我当前方法更好的解决方案?
谢谢!
编辑 - 如果我使用侧边栏面板而不是流体行,这可能更容易完成吗?
【问题讨论】: