0
我有一個選擇框輸入,它根據加載的.csv
文件的列名進行更改。這是我的observeEvent
函數。如何從選擇性輸入中選擇反應性參數?
我在打印輸出到server.R
時遇到了問題,因爲我不確定如何製作反應參數以將SelectizeInput
的輸出轉換爲從SelectBox中選擇的列。有沒有人知道我應該在renderDygraph
輸出內部放置什麼內容,這將顯示我從我的SelectizeInput
中選擇的頻道?
這裏是我的代碼:
ui.R
shinyUI(fluidPage(
# Application title
titlePanel("Graph"),
fluidRow(
column(6,
wellPanel(`
selectInput("dataSelection1", label = "Choose a File",
choices = c("File1")),
selectizeInput("channel1", label = "Choose a Channel",
choices = NULL))),
column(12, dygraphOutput("Graph")
)
)
)
)
server.R
shinyServer(function(input, output, session) {
dataSource1 <- reactive({
switch(input$dataSelection1,
"File1" = File1)
})
observeEvent(input$dataSelection1, {
updateSelectizeInput(session, 'channel1', choices = names(dataSource1()))
})
output$TempRise <- renderDygraph({
component <- switch(input$channel1,
**'WHAT TO PUT IN HERE?'**)
dygraph(component, main = "Data Graph") %>%
dyRangeSelector() %>%
dyOptions(colors = RColorBrewer::brewer.pal(8, "Dark2"))
})
})
謝謝你,@MarkeD這個伎倆! – Gary