sparkline: Sparkline

View source: R/widget-display.R

sparklineR Documentation

Sparkline

Description

A tiny line chart made of block characters (⁠\u2581⁠ to ⁠\u2588⁠), one column per value. With more values than columns, the latest values are shown (summary = "tail") or buckets are averaged ("mean"). Missing values are blank. Use push() to stream values.

Usage

sparkline(
  data = numeric(),
  min = NULL,
  max = NULL,
  summary = "tail",
  max_length = 1000L,
  id = NULL,
  classes = NULL,
  style = NULL
)

Arguments

data

Numeric vector.

min, max

Fixed scale; NULL uses the range of the data.

summary

"tail" or "mean".

max_length

Number of values kept by push().

id

Optional identifier.

classes

Optional classes.

style

A style(); the foreground colour colours the bars.

Value

A Sparkline with reactive data and method push().

Examples

render_widget(sparkline(c(1, 4, 2, 8, 5, NA, 7)), 7, 1)

termr documentation built on Oct. 21, 2026, 5:13 p.m.