getPlotConfig | R Documentation |
Result will be sent through a reactive input (see example below).
getPlotConfig(id, configInputId)
id |
Output variable to read from (id which references the requested plot). |
configInputId |
Reactive input to write to. |
No return value, called from shiny applications for side effects.
## Not run:
if(interactive() && require(shiny)) {
library(shiny)
library(shinyjs)
library(parallelPlot)
ui <- fluidPage(
useShinyjs(),
p("Use button to save widget as an html file, reproducing its configuration"),
actionButton("downloadButton", "Download Widget"),
downloadButton("associatedDownloadButton", "Download Widget",
style = "visibility: hidden;"
),
parallelPlotOutput("parPlot")
)
server <- function(input, output, session) {
output$parPlot <- renderParallelPlot({
parallelPlot(iris)
})
observeEvent(input$downloadButton, {
parallelPlot::getPlotConfig("parPlot", "ConfigForDownload")
})
observeEvent(input$ConfigForDownload, {
ppForDownload <<- parallelPlot(
data = iris,
categorical = input$ConfigForDownload$categorical,
categoriesRep = input$ConfigForDownload$categoriesRep,
arrangeMethod = input$ConfigForDownload$arrangeMethod,
inputColumns = input$ConfigForDownload$inputColumns,
keptColumns = input$ConfigForDownload$keptColumns,
histoVisibility = input$ConfigForDownload$histoVisibility,
invertedAxes = input$ConfigForDownload$invertedAxes,
cutoffs = input$ConfigForDownload$cutoffs,
refRowIndex = input$ConfigForDownload$refRowIndex,
refColumnDim = input$ConfigForDownload$refColumnDim,
rotateTitle = input$ConfigForDownload$rotateTitle,
columnLabels = input$ConfigForDownload$columnLabels,
continuousCS = input$ConfigForDownload$continuousCS,
categoricalCS = input$ConfigForDownload$categoricalCS,
controlWidgets = NULL,
cssRules = input$ConfigForDownload$cssRules,
sliderPosition = input$ConfigForDownload$sliderPosition
)
shinyjs::runjs("document.getElementById('associatedDownloadButton').click();")
})
output$associatedDownloadButton <- downloadHandler(
filename = function() {
paste("parallelPlot-", Sys.Date(), ".html", sep = "")
},
content = function(tmpContentFile) {
htmlwidgets::saveWidget(ppForDownload, tmpContentFile)
}
)
}
shinyApp(ui, server)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.