PixelGraph
extends Element
Multi-series graph rendered at 2x3 subpixel resolution per cell.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| minValue | number | 0 | Lower bound of the value axis |
| maxValue | number | 100 | Upper bound of the value axis |
| background | number|false | colors.black | Background color (false = transparent) |
| width | number | 20 | Width in terminal cells (2 subpixel columns per cell) |
| height | number | 8 | Height 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 nameopts (
table, optional) color/pointCount/visible optionsreturns (
self)
PixelGraph:getSeries(name)
Returns a named series definition.
name (
string) Series namereturns series (
table|nil)
PixelGraph:removeSeries(name)
Removes a named series.
name (
string) Series namereturns (
self)
PixelGraph:setSeriesVisible(name, visible)
Changes visibility of one series.
name (
string) Series namevisible (
boolean) Visibilityreturns (
self)
PixelGraph:addPoint(name, value)
Appends a point; the series scrolls once pointCount is reached.
name (
string) Series namevalue (
number) Point valuereturns (
self)
PixelGraph:clear(name)
Clears one series or every series when name is nil.
name (
string, optional) Series namereturns (
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)