| @@ -3,4 +3,5 @@ | |||
| export(frappeChart) | |||
| export(frappeChartOutput) | |||
| export(renderFrappeChart) | |||
| export(updateFrappeChart) | |||
| import(htmlwidgets) | |||
| @@ -1,6 +1,6 @@ | |||
| #' <Add Title> | |||
| #' Create a Frappe Chart | |||
| #' | |||
| #' <Add Description> | |||
| #' Creates a Frappe Chart | |||
| #' | |||
| #' @import htmlwidgets | |||
| #' | |||
| @@ -64,3 +64,9 @@ renderFrappeChart <- function(expr, env = parent.frame(), quoted = FALSE) { | |||
| if (!quoted) { expr <- substitute(expr) } # force quoted | |||
| 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)) | |||
| } | |||
| @@ -546,3 +546,5 @@ To make this work we will: | |||
| Demo the app, now updates are fast! | |||
| 1. Write a user-friendly wrapper around `sendCustomMessage` called `updateFrappeChart()` | |||
| @@ -40,7 +40,7 @@ server <- function(input, output, session) { | |||
| }) | |||
| observe({ | |||
| session$sendCustomMessage("frappeCharts:update", list(id = "chart", data = data())) | |||
| updateFrappeChart("chart", data()) | |||
| }) | |||
| } | |||
| @@ -4,11 +4,14 @@ | |||
| \alias{frappeChart-shiny} | |||
| \alias{frappeChartOutput} | |||
| \alias{renderFrappeChart} | |||
| \alias{updateFrappeChart} | |||
| \title{Shiny bindings for frappeChart} | |||
| \usage{ | |||
| frappeChartOutput(outputId, width = "100\%", height = "400px") | |||
| renderFrappeChart(expr, env = parent.frame(), quoted = FALSE) | |||
| updateFrappeChart(inputId, data, session = shiny::getDefaultReactiveDomain()) | |||
| } | |||
| \arguments{ | |||
| \item{outputId}{output variable to read from} | |||
| @@ -2,10 +2,19 @@ | |||
| % Please edit documentation in R/frappeChart.R | |||
| \name{frappeChart} | |||
| \alias{frappeChart} | |||
| \title{<Add Title>} | |||
| \title{Create a Frappe Chart} | |||
| \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{ | |||
| <Add Description> | |||
| Creates a Frappe Chart | |||
| } | |||