Browse Source

Add updateFrappeChart()

master
Garrick Aden-Buie 6 years ago
parent
commit
4706d89183
6 changed files with 27 additions and 6 deletions
  1. +1
    -0
      NAMESPACE
  2. +8
    -2
      R/frappeChart.R
  3. +2
    -0
      dev/dev.Rmd
  4. +1
    -1
      dev/shiny/app.R
  5. +3
    -0
      man/frappeChart-shiny.Rd
  6. +12
    -3
      man/frappeChart.Rd

+ 1
- 0
NAMESPACE View File

@@ -3,4 +3,5 @@
export(frappeChart)
export(frappeChartOutput)
export(renderFrappeChart)
export(updateFrappeChart)
import(htmlwidgets)

+ 8
- 2
R/frappeChart.R View File

@@ -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))
}

+ 2
- 0
dev/dev.Rmd View File

@@ -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()`


+ 1
- 1
dev/shiny/app.R View File

@@ -40,7 +40,7 @@ server <- function(input, output, session) {
})

observe({
session$sendCustomMessage("frappeCharts:update", list(id = "chart", data = data()))
updateFrappeChart("chart", data())
})
}


+ 3
- 0
man/frappeChart-shiny.Rd View File

@@ -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}

+ 12
- 3
man/frappeChart.Rd View File

@@ -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
}

Loading…
Cancel
Save