etui/widgets/canvas

Types

pub type Canvas {
  Canvas(
    series: List(Series),
    max_val: Int,
    bg: style.Color,
    period: Int,
  )
}

Constructors

  • Canvas(
      series: List(Series),
      max_val: Int,
      bg: style.Color,
      period: Int,
    )

    Arguments

    max_val

    0 = auto-compute max from all series data.

    period

    Animation period in frames.

pub type Series {
  Series(data: List(Int), fill: SeriesFill)
}

Constructors

pub type SeriesFill {
  SeriesSolid(c: style.Color)
  SeriesGradient(stops: List(style.Color))
  SeriesRainbow
  SeriesAnimatedRainbow
}

Constructors

  • SeriesSolid(c: style.Color)

    Single solid color for all dots.

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

    Left-to-right gradient across the canvas width (in pixels).

  • SeriesRainbow

    Per-column rainbow, static.

  • SeriesAnimatedRainbow

    Rainbow that rotates hue over time.

Values

pub fn canvas_new(series: List(Series)) -> Canvas
pub fn render(
  buf: buffer.Buffer,
  area: geometry.Rect,
  c: Canvas,
  frame: Int,
) -> buffer.Buffer

Render canvas into area. frame drives animated fills.

pub fn series_new(data: List(Int)) -> Series
pub fn with_bg(c: Canvas, bg: style.Color) -> Canvas
pub fn with_max(c: Canvas, max: Int) -> Canvas
pub fn with_period(c: Canvas, period: Int) -> Canvas
pub fn with_series_fill(s: Series, fill: SeriesFill) -> Series
Search Document