charts
Charts module: registers Graph, BarChart, LineChart and PixelGraph elements.
lua
basalt.use("charts")
local graph = frame:addGraph({ x = 2, y = 2, width = 20, height = 8 })
graph:addSeries("cpu", { symbol = " ", bg = colors.red, pointCount = 20 })
graph:addPoint("cpu", 42)
frame:addBarChart({ ... }).data = { 3, 8, 2, 10 }
frame:addLineChart({ ... }).data = { 1, 5, 3, 9, 4 }
-- PixelGraph plots at 2x3 subpixel resolution per cell (via the same
-- mosaic engine the Image element uses for FLIMG sprites), so lines
-- look smooth instead of one blocky point per cell.
local pixelGraph = frame:addPixelGraph({ x = 2, y = 2, width = 20, height = 8 })
pixelGraph:addSeries("cpu", { color = colors.red })
pixelGraph:addPoint("cpu", 42)Fields
| Field | Type | Description |
|---|---|---|
| Graph | Graph | Registered Graph element class |
| BarChart | BarChart | Registered BarChart element class |
| LineChart | LineChart | Registered LineChart element class |
| PixelGraph | PixelGraph | Registered PixelGraph element class |