Reputation: 747
The problem is I want to put a helpText
object at the right of a sidebarPanel
object. Here is my code:
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'))
)
))
However, the helpText is just below the sidebarPanel. How can I fix this and make helpText object at the right blank area. Thanks.
Upvotes: 0
Views: 138
Reputation: 5471
You can add mainPanel
to the first column and put there helpText
. In the example below I set the width of the column to 8 out of max 12.
This mainPanel
is 8/12 of the column of the width 8 and sidebarPanel
is of width 4/12 of the same column.
There is still a place for another column with maximal width of 4 and I placed there another helpText
.
This answer may be a little bit off topic but the question was vage as well :)
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)
Upvotes: 1