问题是我想在helpText
对象的右侧放置一个sidebarPanel
对象。这是我的代码:
ui <- (fluidPage(
# Application title
fluidRow(
column(12,
sidebarPanel(
titlePanel("Visualization"),
actionButton("goButton", "Go"),
actionButton("reset", "Reset"),
actionButton("pause", "Pause"),
actionButton("resume", "Resume"),
textInput("initial", "Initial Value", value = "c(-5, 5, 5)") ,
textInput("targ", "Target", value = "c(0, 0, 0)"),
textInput("func", "Objective Function", value = "x1 ^ 2 + exp(x2 ^ 2) + 5 + x3 ^ 2")
)),
column(12,helpText('XXX'))
)
))
但是,helpText位于sidebarPanel下方。如何解决此问题并在右侧空白区域创建helpText对象。 感谢。
答案 0 :(得分:1)
您可以将mainPanel
添加到第一列并将helpText
放在那里。在下面的示例中,我将列的宽度设置为最大12的8。
此mainPanel
是宽度为8的列的8/12,sidebarPanel
的宽度为同一列的4/12。
还有一个地方可以容纳另一列,最大宽度为4,我在那里放了另一个helpText
。
这个答案可能有点偏离主题,但问题也是vage:)
library(shiny)
ui <- fluidPage(
fluidRow(
column(8, # column width goes from 1 to 12 where 12 is the whole screen
sidebarPanel( # default 4 / 12 ... in this case 3/4 of 8
titlePanel("Visualization"),
actionButton("goButton", "Go"),
actionButton("reset", "Reset"),
actionButton("pause", "Pause"),
actionButton("resume", "Resume"),
textInput("initial", "Initial Value", value = "c(-5, 5, 5)") ,
textInput("targ", "Target", value = "c(0, 0, 0)"),
textInput("func", "Objective Function", value = "x1 ^ 2 + exp(x2 ^ 2) + 5 + x3 ^ 2")
),
mainPanel( # 8 /12 ... so 3/4 of 8
helpText('XXX'),
helpText("width of the mainPanel within the first column"),
hr()
)
),
column(4,
br(),
helpText('width of the second column'),
hr()
)
)
)
server <- shinyServer(function(input, output) {
})
shinyApp(ui, server)