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.
-
ChartRainbowRainbow, one hue per bar.
-
ChartAnimatedRainbowRainbow that rotates hue over time.
-
ChartVerticalGradient(stops: List(style.Color))Gradient from bottom (cold) to top (warm), per cell.
Values
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_bg(c: Chart, bg: style.Color) -> Chart
pub fn with_style(c: Chart, s: style.Style) -> Chart