Skip to content

PixelGraph

extends Element

Multi-series graph rendered at 2x3 subpixel resolution per cell.

Properties

PropertyTypeDefaultDescription
minValuenumber0Lower bound of the value axis
maxValuenumber100Upper bound of the value axis
backgroundnumber|falsecolors.blackBackground color (false = transparent)
widthnumber20Width in terminal cells (2 subpixel columns per cell)
heightnumber8Height in terminal cells (3 subpixel rows per cell)

Methods

PixelGraph:setup()

Initializes per-instance state.

PixelGraph:addSeries(name, opts)

opts: color (default white), pointCount (default width*2 subpixel columns), visible (default true) Adds a named graph series.

  • name (string) Series name

  • opts (table, optional) color/pointCount/visible options

  • returns (self)

PixelGraph:getSeries(name)

Returns a named series definition.

  • name (string) Series name

  • returns series (table|nil)

PixelGraph:removeSeries(name)

Removes a named series.

  • name (string) Series name

  • returns (self)

PixelGraph:setSeriesVisible(name, visible)

Changes visibility of one series.

  • name (string) Series name

  • visible (boolean) Visibility

  • returns (self)

PixelGraph:addPoint(name, value)

Appends a point; the series scrolls once pointCount is reached.

  • name (string) Series name

  • value (number) Point value

  • returns (self)

PixelGraph:clear(name)

Clears one series or every series when name is nil.

  • name (string, optional) Series name

  • returns (self)

PixelGraph:render(buf)

Renders every series into a 2x3-subpixel-per-cell grid and blits it through the mosaic pixel engine.

  • buf (Render) The render buffer (local coordinates, pre-clipped)

Last updated:

Released under the MIT License.