我正在构建一个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个动作按钮,使用宽度为1.33的3列各自不起作用。第三,也许最重要的是,创建大量的fluidRows(而不是1个fluidRow,我能够包裹按钮(这就是我想要的!))并不允许我在上面添加我的图。闪亮的应用程序的右侧,没有弄乱左侧的格式。
以前是否有人遇到过这个问题,并熟悉我目前的方法更好的解决方案?
谢谢!
编辑 - 如果我使用sidebarpanel而不是flowrows,这可能更容易完成?
答案 0 :(得分:0)
我可能已经使用splitLayout()函数找到了我自己的问题的解决方案,来自这篇文章 - shiny 4 small textInput boxes side-by-side。
是的!这可以完成工作。