Skip to content

Modern Tui TuiGraph

Paul Squires edited this page Oct 19, 2026 · 6 revisions

Home › Terminal TUI Library › Charts › TuiGraph

TuiGraph

Draws a line graph of one or more series, scaled to fit or to a fixed range.

Syntax

type TuiGraph extends TuiWidget
    as TuiSeriesArray series
    as uint8 graphKind
    as float64 minY, maxY
    as boolean autoScale, showAxes
end type

Description

A line graph over one or more series. TUIGRAPH_BRAILLE gives the highest resolution; _BLOCK and _BAR are the coarser fallbacks for a terminal without a braille font. Turn autoScale off and set minY/maxY when the axis should be stable -- a percentage plot that rescales itself is unreadable.

Example

#import "std/tui"
using tui

dim as TuiScreen scr
scr.Resize( 40, 10 )
dim as TuiFrame ptr f = scr.BeginFrame( )

dim as TuiGraph g
g.graphKind = TUIGRAPH_BRAILLE
g.autoScale = FALSE               '' a percentage axis should not move
g.minY = 0 : g.maxY = 100

dim as TuiSeries s
for i as int32 = 0 to 199
    s.data.Push( 50.0 + sin( i / 9.0 ) * 45.0 )
next
s.color = TuiRgb( 120, 220, 160 )
g.series.Push( s )
g.Render( *f, f->Area( ) )
print g.series.Count( )           '' 1

See also

TuiCanvas TuiCanvas.Dot TuiCanvas.DotWidth TuiCanvas.CellRows
TuiCanvas.Resize TuiCanvas.Line_ TuiCanvas.DotHeight TuiCanvas.Pattern
TuiCanvas.Clear TuiCanvas.Blit TuiCanvas.CellCols TuiSeries

Library: Terminal TUI Library
Category: Terminal TUI Library
Documented under: Charts
Working examples: hello.tiko · form.tiko · dashboard.tiko


Home · Keyword Index

Clone this wiki locally