2016-05-05 3 views
0

問題はsidebarPanelオブジェクトの右側にhelpTextオブジェクトを配置したいという問題です。ここに私のコード:サイドバーとtextInputオブジェクトを1行に作成する方法

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はサイドバーパネルのすぐ下にあります。これを修正し、正しい空白領域にhelpTextオブジェクトを作成するにはどうすればよいですか?おかげさまで

答えて

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) 
+0

1は、ほぼ任意のレイアウトを作成することができますので、あなたの質問に他の可能な答えがたくさんありますグリッドシステム:http://shiny.rstudio.com/articles/layout-guide.html –

関連する問題