Commit 77c6fbbe authored by Midoux Cedric's avatar Midoux Cedric

download the last plot

parent 9325f7cc
options(shiny.maxRequestSize = 30*1024^2) options(shiny.maxRequestSize = 30 * 1024 ^ 2)
library(shinydashboard) library(shinydashboard)
library(dplyr) library(dplyr)
...@@ -152,39 +152,66 @@ shinyServer ...@@ -152,39 +152,66 @@ shinyServer
) )
} }
output$downloadUI <- renderUI({ output$downloadDataUI <- renderUI({
validate(need(data16S(), "")) validate(need(data16S(), ""))
tags$div( tags$div(
style = "text-align:center", style = "text-align:center",
title = "Download file as RData", title = "Download file as RData",
hr(),
downloadButton("downloadData", "Download RData file", style = "color: black; background-color: gray90") downloadButton("downloadData", "Download RData file", style = "color: black; background-color: gray90")
) )
}) })
# current_plot <- reactive({last_plot()})
output$downloadPlotUI <- renderUI({
# validate(need(current_plot(), "azerty"))
tags$div(
style = "text-align:center",
title = "Download the last plot",
downloadButton("downloadPlot", "Download the last plot", style = "color: black; background-color: gray90")
)
})
output$downloadPlot <- {
downloadHandler(
filename = function() {
paste("Easy16S-plot",
ifelse(is.null(input$plotDevice), "png", input$plotDevice),
sep = ".")
},
content = function(file) {
ggsave(
file,
last_plot(),
device = ifelse(is.null(input$plotDevice), "png", input$plotDevice),
units = "cm",
width = ifelse(is.null(input$plotWidth), NA, input$plotWidth),
height = ifelse(is.null(input$plotHeight), NA, input$plotHeight),
dpi = ifelse(is.null(input$plotDPI), 300, input$plotDPI),
limitsize = FALSE
)
}
)
}
observeEvent(input$plotSize, { observeEvent(input$plotSize, {
showModal( showModal(
modalDialog( modalDialog(
title = "Setting plot size", title = "Setting plot size",
numericInput( numericInput(
"plotWidth", "plotWidth",
label = "Plot width : ", label = "Plot width (cm) : ",
value = 6, value = 20,
min = 1, min = 1,
max = 50 max = 100
), ),
numericInput( numericInput(
"plotHeight", "plotHeight",
label = "Plot height : ", label = "Plot height (cm) : ",
value = 6, value = 20,
min = 1, min = 1,
max = 50 max = 100
),
radioButtons(
"plotUnits",
label = "Units : ",
choices = list("in", "cm", "mm"),
selected = "cm",
inline = TRUE
), ),
numericInput( numericInput(
"plotDPI", "plotDPI",
...@@ -198,7 +225,7 @@ shinyServer ...@@ -198,7 +225,7 @@ shinyServer
"plotDevice", "plotDevice",
label = "Plot device : ", label = "Plot device : ",
choices = list("eps", "ps", "tex", "pdf", "jpeg", "tiff", "png", "bmp", "svg"), choices = list("eps", "ps", "tex", "pdf", "jpeg", "tiff", "png", "bmp", "svg"),
selected = "pdf" selected = "png"
), ),
size = "s", size = "s",
easyClose = TRUE, easyClose = TRUE,
...@@ -268,7 +295,7 @@ shinyServer ...@@ -268,7 +295,7 @@ shinyServer
}) })
output$tableGlom <- DT::renderDataTable(server = FALSE, { output$tableGlom <- DT::renderDataTable(server = FALSE, {
Glom <- tax_glom(data16S(), input$glomRank, NArm=FALSE) Glom <- tax_glom(data16S(), input$glomRank, NArm = FALSE)
taxTableGlom <- Glom %>% taxTableGlom <- Glom %>%
tax_table() %>% tax_table() %>%
as.data.frame(stringsAsFactors = FALSE) %>% as.data.frame(stringsAsFactors = FALSE) %>%
......
...@@ -76,8 +76,9 @@ shinyUI(dashboardPage( ...@@ -76,8 +76,9 @@ shinyUI(dashboardPage(
# placeholder = "data.fasta" # placeholder = "data.fasta"
# ) # )
# ), # ),
uiOutput("downloadDataUI"),
hr(), hr(),
uiOutput("downloadUI"), uiOutput("downloadPlotUI"),
tags$div( tags$div(
align = "center", align = "center",
actionButton("plotSize", label = "Plot size") actionButton("plotSize", label = "Plot size")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment