etui/widgets/chart

Types

pub type Chart {
  Chart(
    data: List(Int),
    max_val: Int,
    fill: ChartFill,
    bar_width: Int,
    gap: Int,
    bar_char: String,
    bg: style.Color,
    period: Int,
  )
}

Constructors

  • Chart(
      data: List(Int),
      max_val: Int,
      fill: ChartFill,
      bar_width: Int,
      gap: Int,
      bar_char: String,
      bg: style.Color,
      period: Int,
    )

    Arguments

    max_val

    0 = auto-compute from data.

    bar_width

    Width in chars of each bar.

    gap

    Width in chars of gap between bars.

    bar_char

    Character used for filled cells.

    period

    Animation period in frames.

pub type ChartFill {
  ChartSolid(colors: List(style.Color))
  ChartGradient(stops: List(style.Color))
  ChartRainbow
  ChartAnimatedRainbow
  ChartVerticalGradient(stops: List(style.Color))
}

Constructors

  • ChartSolid(colors: List(style.Color))

    One color per bar; wraps if more bars than colors.

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

    Gradient applied left-to-right across all bars.

  • ChartRainbow

    Rainbow, one hue per bar.

  • ChartAnimatedRainbow

    Rainbow that rotates hue over time.

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

    Gradient from bottom (cold) to top (warm), per cell.

Values

pub fn chart_new(data: List(Int)) -> Chart
pub fn render(
  buf: buffer.Buffer,
  area: geometry.Rect,
  c: Chart,
  frame: Int,
) -> buffer.Buffer

Render chart into area. frame drives animated fills.

pub fn with_bar_width(c: Chart, w: Int) -> Chart
pub fn with_bg(c: Chart, bg: style.Color) -> Chart
pub fn with_fill(c: Chart, fill: ChartFill) -> Chart
pub fn with_gap(c: Chart, g: Int) -> Chart
pub fn with_max(c: Chart, max: Int) -> Chart
pub fn with_period(c: Chart, period: Int) -> Chart
pub fn with_style(c: Chart, s: style.Style) -> Chart
Search Document