#' Modify the echarts object through shiny server
#'
#' Launch a shiny server to modify the generated echart object from the front-end interface,
#' which integrate the general chart optional settings, also the code will show on the page.
#'
#' @param e1 a recharts output object, could be generated by eBar, eLine, eRadar, eMap, eArea, ePoints,
#' eFunnel, eForce and other echarts generate functions(will be added later).
#' @note You are recommended to use lazyPlot function for interactive chart
#' option set through "shiny" server.
#' @export
#' @examples
#' mapData <- head(mapTestData_chs, 5)
#' echartObj <- eMap(mapData, namevar=~stdName, datavar = ~val1 + val2)
#' lazyPlot(echartObj) # will launch the shiny server to
lazyPlot <- function(e1){
if ("recharts" %in% class(e1)){
assign("tempEchartsObject", e1, env=.GlobalEnv)
library(shiny)
if ("eLine" %in% class(e1) | "eArea" %in% class(e1) | "eBar" %in% class(e1) | "ePoints" %in% class(e1)){
# eLine/eArea/eBar LazyPlot.
runApp(system.file("shiny","lazyPlot","eLine_Area", package = "recharts"))
}else if("eMap" %in% class(e1)){
# eMap lazyPlot
runApp(system.file("shiny","lazyPlot","eMap", package = "recharts"))
}
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.