【发布时间】:2020-01-13 12:39:37
【问题描述】:
我通过反应返回一个分组的绘图对象,并希望交替呈现超链接和绘图。
我尝试用交替标签制作一个标签列表
#UI Snippet
mainPanel(uiOutput("plots"))
#Server Snippet
plots2 <- data.test.consecutive.filter %>%
group_by(SupplierKey, MaterialKey, TareRange,URL) %>%
arrange (SupplierKey, MaterialKey, TareRange, ShipmentDate) %>%
do(
plots = ggplot(data = .)
+ aes(x = ShipmentDate, y = last20.ZScore, group = 1) + ggtitle(
paste(
"Supplier:",
.$SupplierNo,
" ,",
"Material Key:",
.$MaterialKey,
" ,",
"Tare Range:",
.$TareRange
)
) + geom_line(linetype = "dashed") +
geom_point() +
geom_hline(yintercept =0) +
geom_hline(yintercept = 1.5, color = "red") +
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())
)
vals <- plots2 #reactiveReturn
output$plots <- renderUI({
plot_list <- vals()
plot_output_list <- list()
for(i in 1:length(plot_list$plots)){
plotname <- paste("plot", i, sep = "")
plot.tag <- plotOutput(plotname, height = 500, width = 1000)
link.tag <- tags$a(href=plot_list$URL[i],plot_list$SupplierKey[i])
plot_output_list <- c(plot_output_list,c(plot.tag,link.tag))
}
tagList(plot_output_list)
})
plot_object <- vals()
plot_list <- plot_object$plots
withProgress(message = 'Rendering plots', value = 0, {
for (i in 1:length(plot_list)) {
local({
my_i <- i
plotname <- paste("plot", my_i, sep="")
output[[plotname]] <- renderPlot({
plot_list[[my_i]]
})
})
}
})
只在主面板中获取文本
例如:Output div plot1 闪亮绘图输出宽度:1000px;高度:500px a 网址 div plot2 闪亮绘图输出宽度:1000px;高度:500px a 网址 div plot3 闪亮绘图输出宽度:1000px;高度:500px a 网址 div plot4 闪亮绘图输出宽度:1000px;高度:500px a 网址 div plot5 闪亮绘图输出宽度:1000px;高度:500px a 网址
预期输出: 阴谋 网址 阴谋 网址等
【问题讨论】:
-
你能说得更具体点吗?什么工作/不工作。您当前的输出和期望的输出有什么区别?既然您想改进 UI,最好能截屏并向我们展示您所拥有的。
-
编辑:为清楚起见添加了屏幕截图