Create a box with a sparkline
spark_box( data, title = NULL, subtitle = NULL, color = "#2E93fA", background = "#FFF", type = c("area", "line", "spline", "column"), synchronize = NULL, title_style = NULL, subtitle_style = NULL, width = NULL, height = NULL, elementId = NULL )
data | A |
---|---|
title | Title to display in the box. |
subtitle | Subtitle to display in the box. |
color | Color of the chart. |
background | Background color of the box. |
type | Type of chart, currently type supported are :
|
synchronize | Give a common id to charts to synchronize them (tooltip and zoom). |
title_style, subtitle_style | A |
width, height | A numeric input in pixels. |
elementId | Use an explicit element ID for the widget. |
An apexcharts
htmlwidget
object.
In Shiny use sparkBoxOutput
/ renderSparkBox
to render boxes, see example.
Boxes have CSS class "apexcharter-spark-box"
if you need more styling.
library(apexcharter) spark_data <- data.frame( date = Sys.Date() + 1:20, var1 = round(rnorm(20, 50, 10)), var2 = round(rnorm(20, 50, 10)), var3 = round(rnorm(20, 50, 10)) ) spark_box( data = spark_data, title = mean(spark_data$var1), subtitle = "Variable 1" ) # In Shiny if (interactive()) { run_sparkbox_demo() }