我想将选项卡面板动态添加到选项卡框,然后在其中添加渲染图。这是我的代码:
server <- function(input, output) {
df <- read.table('./Files/test.blu', sep="\t", header=T)
df$TesterPart <- paste(df$Tester, df$PartNo)
testers <- levels(df$Tester)
index=2
strPrevTester="Main"
for (tester in testers) {
strPlotVar = paste("plot1",index, sep = "")
strInputId = paste("lo", index-1, sep = "")
insertTab(inputId="lo" , tabPanel(tester, plotlyOutput(strPlotVar)), target = "Main")
output[strPlotVar] <- renderPlotly({
df_ <- df %>% select(Date, param, PartNo) %>%
filter(param < 0.05) %>%
filter(param > -0.05)
df_$Date <- as.POSIXct( df_$Date , format = "%m/%d/%Y %I:%M %p" , tz = "GMT")
p <- plotly::plot_ly(data=df_, y = ~param, x=~Date ,color = ~PartNo, type="box", boxpoints = "all", jitter=0.3, pointpos = -0.0)
})
index=index+1
strPrevTester=tester
}
}
如何从服务器函数输出变量中访问plotlyOutput变量。