# HG changeset patch # User uncorrelated zombie # Date 1667098446 -32400 # Node ID 7db5a949ba24b86fa3beb1961b2fe69699eaebd6 # Parent 9535740da2244e7fe20ce1c717211779603369fb 入力に意味が無い場合にチェックボックスを表示しないようにする diff -r 9535740da224 -r 7db5a949ba24 ShinyEB.R --- a/ShinyEB.R Fri Oct 28 00:44:26 2022 +0900 +++ b/ShinyEB.R Sun Oct 30 11:54:06 2022 +0900 @@ -20,7 +20,15 @@ value = 0.3), checkboxInput("isIP", "Initial Point", TRUE), checkboxInput("isIC_I", "Indiffrent Curves pass through the Initial Point", TRUE), - checkboxInput("isCore", "Core (this works only if the indiffrent curves above were plotted)", TRUE), + # チェックボックスありとなしの見えないタブを作る + tabsetPanel( + id = "tab4core", + type = "hidden", + tabPanel("true", + checkboxInput("isCore", "Core", TRUE) + ), + tabPanel("false") + ), checkboxInput("isIC_E", "Indiffrent Curves pass through the Equilibrium", TRUE), checkboxInput("isSHP", "Separating Hyperplane", TRUE), checkboxInput("isCC", "Contract Curve", TRUE) @@ -33,8 +41,13 @@ ) server <- function(input, output) { + # input$isIC_Iが変更されたら、見えないタブを切り替える + observeEvent(input$isIC_I, { + updateTabsetPanel(inputId = "tab4core", selected = ifelse(input$isIC_I, "true", "false")) + }) + output$distPlot <- renderPlot({ - # inputにはwithが使えない + # inputはReactiveValuesクラスで$で参照できる変数を陽に持たないため、withやattachが使えない drawEdgeworthBox(input$A, input$B, CC=input$isCC, SHP=input$isSHP, IC_I=input$isIC_I, IC_E=input$isIC_E, CORE=input$isCore, IP=input$isIP) }, width=500, height=500)