htmlwidgets / sparkline

jQuery Sparkline HTML Widget for R
Other
244 stars 40 forks source link

sparklineOutput and renderSparkline #5

Closed hadley closed 9 years ago

hadley commented 9 years ago

Could you please add so we can use this package with shiny?

hadley commented 9 years ago
sparklineOutput <- function(outputId, width = "60px", height = "20px") {
  htmlwidgets::shinyWidgetOutput(outputId, "sparkline", width, height)
}

# shiny render function for a widget named 'foo'
renderSparkline <- function(expr, env = parent.frame(), quoted = FALSE) {
  if (!quoted) { expr <- substitute(expr) } # force quoted
  htmlwidgets::shinyRenderWidget(expr, sparklineOutput, env, quoted = TRUE)
}
ramnathv commented 9 years ago

Done!