#' AreaBump
#'
#' <Add Description>
#'
#' @import htmlwidgets
#'
#' @export
areabump <- function(elementId, width = NULL, height = NULL, ...) {
# describe a React component to send to the browser for rendering.
# component <- reactR::reactMarkup(htmltools::tag("div", list(message)))
component <- reactR::reactMarkup(reactR::component("AreaBumpCustom", list(...)))
# create widget
htmlwidgets::createWidget(
name = 'areabump',
component,
width = width,
height = height,
package = 'nivoR',
elementId = elementId
)
}
#' Called by HTMLWidgets to produce the widget's root element.
#' @noRd
widget_html.areabump <- function(id, style, class, ...) {
htmltools::tagList(
# Necessary for RStudio viewer version < 1.2
reactR::html_dependency_corejs(),
reactR::html_dependency_react(),
reactR::html_dependency_reacttools(),
htmltools::tags$div(id = id, class = class, style = style)
)
}
#' Shiny bindings for areabump
#'
#' Output and render functions for using areabump within Shiny
#' applications and interactive Rmd documents.
#'
#' @param outputId output variable to read from
#' @param width,height Must be a valid CSS unit (like \code{'100\%'},
#' \code{'400px'}, \code{'auto'}) or a number, which will be coerced to a
#' string and have \code{'px'} appended.
#' @param expr An expression that generates a areabump
#' @param env The environment in which to evaluate \code{expr}.
#' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This
#' is useful if you want to save an expression in a variable.
#'
#' @name areabump-shiny
#'
#' @export
areabumpOutput <- function(outputId, width = '100%', height = '400px'){
htmlwidgets::shinyWidgetOutput(outputId, 'areabump', width, height, package = 'nivoR')
}
#' @rdname areabump-shiny
#' @export
renderAreabump <- function(expr, env = parent.frame(), quoted = FALSE) {
if (!quoted) { expr <- substitute(expr) } # force quoted
htmlwidgets::shinyRenderWidget(expr, areabumpOutput, env, quoted = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.