From 7e495bd34e059ab8fa902b09e2c43b22adb24a16 Mon Sep 17 00:00:00 2001
From: Eduardo Junior <edujrrib@gmail.com>
Date: Wed, 9 Dec 2015 23:54:56 -0200
Subject: [PATCH] =?UTF-8?q?Reorganiza=20layout=20da=20aplica=C3=A7=C3=A3o?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Separa os gráficos referentes à distribuição amostral da média e os
exibe separadamente, pois empilhadas dificultam a visualização dos
outputs e inputs conjuntamente.
---
 shiny/distProb/server.R | 38 ++++++++++++++++++++++++++++++++++++++
 shiny/distProb/ui.R     | 19 +++++++++++--------
 2 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/shiny/distProb/server.R b/shiny/distProb/server.R
index 5e7dfbb..b85889e 100644
--- a/shiny/distProb/server.R
+++ b/shiny/distProb/server.R
@@ -277,4 +277,42 @@ shinyServer(
                    
                    ) ## switch()
         }) ## renderUI
+
+        ## Opções para média amostral
+        output$OptsMedia <- renderUI({
+            if (input$tab == "Distribuição") {
+                return(NULL)
+            } else {
+                wellPanel(
+                    numericInput(
+                        inputId="n",
+                        label="Tamanho da amostra:",
+                        min = 2, max = 1000, value=10),
+                    HTML("<label>Tipo de gráfico: </label>"),
+                    tabsetPanel(
+                        id = "graf",
+                        type = "pills",
+                        tabPanel("Density"),
+                        tabPanel("ECDF"),
+                        tabPanel("Q-QNorm")
+                    ),
+                    helpText("Baseados em 500 amostras")
+                )
+            }
+        })
+
+        ## Gráficos para a distribuição média amostral 
+        output$grafsMedia <- renderUI({
+            if (is.null(input$graf)) {
+                return(NULL)
+            } else {
+                switch(
+                    input$graf,
+                    "Density" = plotOutput("density"),
+                    "ECDF" = plotOutput("ecdf"),
+                    "Q-QNorm" = plotOutput("qqnorm")
+                )
+            }
+        })
+        
     }) ## shinyServer()
diff --git a/shiny/distProb/ui.R b/shiny/distProb/ui.R
index c20a026..da960cd 100644
--- a/shiny/distProb/ui.R
+++ b/shiny/distProb/ui.R
@@ -13,19 +13,22 @@ shinyUI(
 
         titlePanel("Distribuições de probabilidade"),
         sidebarPanel(
-            numericInput(inputId="n",
-                         label="Tamanho da amostra:",
-                         value=10),
             selectInput(inputId="dist",
                         label="Distribuição",
                         choices=choi),
-            uiOutput("ui")
+            uiOutput("ui"),
+            
+            uiOutput("OptsMedia")
         ),
         mainPanel(
-            plotOutput("plot"),
-            plotOutput("density"),
-            plotOutput("ecdf"),
-            plotOutput("qqnorm")
+            tabsetPanel(
+                id = "tab", 
+                tabPanel("Distribuição", 
+                         plotOutput("plot")),
+                tabPanel("Distribuição Amostral da Média",
+                         uiOutput("grafsMedia")
+                         )
+            )
         )
     )
 )
\ No newline at end of file
-- 
GitLab