| export(frappeChart) | export(frappeChart) | ||||
| export(frappeChartOutput) | export(frappeChartOutput) | ||||
| export(renderFrappeChart) | export(renderFrappeChart) | ||||
| export(updateFrappeChart) | |||||
| import(htmlwidgets) | import(htmlwidgets) |
| #' <Add Title> | |||||
| #' Create a Frappe Chart | |||||
| #' | #' | ||||
| #' <Add Description> | |||||
| #' Creates a Frappe Chart | |||||
| #' | #' | ||||
| #' @import htmlwidgets | #' @import htmlwidgets | ||||
| #' | #' | ||||
| if (!quoted) { expr <- substitute(expr) } # force quoted | if (!quoted) { expr <- substitute(expr) } # force quoted | ||||
| htmlwidgets::shinyRenderWidget(expr, frappeChartOutput, env, quoted = TRUE) | htmlwidgets::shinyRenderWidget(expr, frappeChartOutput, env, quoted = TRUE) | ||||
| } | } | ||||
| #' @rdname frappeChart-shiny | |||||
| #' @export | |||||
| updateFrappeChart <- function(inputId, data, session = shiny::getDefaultReactiveDomain()) { | |||||
| session$sendCustomMessage("frappeCharts:update", list(id = inputId, data = data)) | |||||
| } |
| Demo the app, now updates are fast! | Demo the app, now updates are fast! | ||||
| 1. Write a user-friendly wrapper around `sendCustomMessage` called `updateFrappeChart()` | |||||
| }) | }) | ||||
| observe({ | observe({ | ||||
| session$sendCustomMessage("frappeCharts:update", list(id = "chart", data = data())) | |||||
| updateFrappeChart("chart", data()) | |||||
| }) | }) | ||||
| } | } | ||||
| \alias{frappeChart-shiny} | \alias{frappeChart-shiny} | ||||
| \alias{frappeChartOutput} | \alias{frappeChartOutput} | ||||
| \alias{renderFrappeChart} | \alias{renderFrappeChart} | ||||
| \alias{updateFrappeChart} | |||||
| \title{Shiny bindings for frappeChart} | \title{Shiny bindings for frappeChart} | ||||
| \usage{ | \usage{ | ||||
| frappeChartOutput(outputId, width = "100\%", height = "400px") | frappeChartOutput(outputId, width = "100\%", height = "400px") | ||||
| renderFrappeChart(expr, env = parent.frame(), quoted = FALSE) | renderFrappeChart(expr, env = parent.frame(), quoted = FALSE) | ||||
| updateFrappeChart(inputId, data, session = shiny::getDefaultReactiveDomain()) | |||||
| } | } | ||||
| \arguments{ | \arguments{ | ||||
| \item{outputId}{output variable to read from} | \item{outputId}{output variable to read from} |
| % Please edit documentation in R/frappeChart.R | % Please edit documentation in R/frappeChart.R | ||||
| \name{frappeChart} | \name{frappeChart} | ||||
| \alias{frappeChart} | \alias{frappeChart} | ||||
| \title{<Add Title>} | |||||
| \title{Create a Frappe Chart} | |||||
| \usage{ | \usage{ | ||||
| frappeChart(message, width = NULL, height = NULL, elementId = NULL) | |||||
| frappeChart( | |||||
| data, | |||||
| type = c("line", "bar", "pie", "percentage", "heatmap"), | |||||
| title = "", | |||||
| ..., | |||||
| is_navigable = TRUE, | |||||
| width = NULL, | |||||
| height = 250, | |||||
| elementId = NULL | |||||
| ) | |||||
| } | } | ||||
| \description{ | \description{ | ||||
| <Add Description> | |||||
| Creates a Frappe Chart | |||||
| } | } |