etui/widgets/sparkline

Types

pub type SparkFill {
  SparkGradient(stops: List(style.Color))
  SparkAnimated(stops: List(style.Color))
  SparkRainbow
  SparkAnimatedRainbow
  SparkSolid(c: style.Color)
}

Constructors

  • SparkGradient(stops: List(style.Color))

    Static left-to-right gradient across color stops.

  • SparkAnimated(stops: List(style.Color))

    Gradient that scrolls left over time.

  • SparkRainbow

    Static full-spectrum rainbow.

  • SparkAnimatedRainbow

    Rainbow that rotates hue over time.

  • SparkSolid(c: style.Color)

    Single solid color.

pub type Sparkline {
  Sparkline(
    data: List(Int),
    max_val: Int,
    fill: SparkFill,
    bg: style.Color,
    modifier: style.Modifier,
    period: Int,
  )
}

Constructors

  • Sparkline(
      data: List(Int),
      max_val: Int,
      fill: SparkFill,
      bg: style.Color,
      modifier: style.Modifier,
      period: Int,
    )

    Arguments

    max_val

    Expected maximum value. 0 = auto-compute from data.

    period

    Animation period in frames (for animated fills).

Values

pub fn render(
  buf: buffer.Buffer,
  area: geometry.Rect,
  s: Sparkline,
  frame: Int,
) -> buffer.Buffer

Render the sparkline. frame drives animated fills.

pub fn sparkline_new(data: List(Int)) -> Sparkline
pub fn with_bg(s: Sparkline, bg: style.Color) -> Sparkline
pub fn with_fill(s: Sparkline, fill: SparkFill) -> Sparkline
pub fn with_max(s: Sparkline, max: Int) -> Sparkline
pub fn with_modifier(
  s: Sparkline,
  m: style.Modifier,
) -> Sparkline
pub fn with_period(s: Sparkline, period: Int) -> Sparkline
pub fn with_style(s: Sparkline, st: style.Style) -> Sparkline
Search Document