Skip to content
Permalink
Browse files

esquisse module return ggplot2 code

  • Loading branch information...
pvictor committed Dec 31, 2018
1 parent 2196a46 commit 116c589a015084912b546e4e0b5a44e548f1c665
Showing with 22 additions and 3 deletions.
  1. +1 −1 DESCRIPTION
  2. +14 −1 R/esquisserServer.R
  3. +2 −0 R/esquisserUI.R
  4. +2 −1 R/module-code.R
  5. +3 −0 man/esquisse-module.Rd
@@ -1,7 +1,7 @@
Package: esquisse
Type: Package
Title: Explore and Visualize Your Data Interactively
Version: 0.1.7.920
Version: 0.1.7.930
Authors@R: c(person("Fanny", "Meyer", email = "fanny.meyer@dreamrs.fr", role = c("aut")),
person("Victor", "Perrier", email = "victor.perrier@dreamrs.fr", role = c("aut", "cre")),
person("Ian", "Carroll", comment = "Facets support", role = "ctb"))
@@ -192,7 +192,7 @@ esquisserServer <- function(input, output, session, data = NULL, dataModule = c(
})

# Code
callModule(
res_code <- callModule(
moduleCodeServer, id = "controls-code",
varSelected = aes_r,
dataChart = dataChart,
@@ -202,6 +202,19 @@ esquisserServer <- function(input, output, session, data = NULL, dataModule = c(

# Close addin
observeEvent(input$close, shiny::stopApp())

output_module <- reactiveValues(code = NULL, data = NULL)
observeEvent(res_code(), {
output_module$code <- res_code()
}, ignoreInit = TRUE)
observeEvent(list(dataChart$data, paramsChart$index), {
data <- dataChart$data
if (!is.null(paramsChart$index) && is.logical(paramsChart$index)) {
data <- data[paramsChart$index, , drop = FALSE]
}
output_module$data <- data
}, ignoreInit = TRUE)

return(output_module)
}

@@ -6,6 +6,8 @@
#' @param header Logical. Display or not \code{esquisse} header.
#' @param choose_data Logical. Display or not the button to choose data.
#'
#' @return A \code{reactiveValues} with two slots: \code{"code"}: code to generate the plot, \code{"data"} the \code{data.frame} used.
#'
#' @note For the module to display correctly, it is necessary to place it in a container with a fixed height.
#'
#' @export
@@ -158,7 +158,8 @@ moduleCodeServer <- function(input, output, session, varSelected, dataChart, par
rCodeContainer(id = ns("codeggplot"), codegg())
)
})


return(codegg)
}


Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 116c589

Please sign in to comment.
You can’t perform that action at this time.