Skip to content

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

FieldTypeDescription
GraphGraphRegistered Graph element class
BarChartBarChartRegistered BarChart element class
LineChartLineChartRegistered LineChart element class
PixelGraphPixelGraphRegistered PixelGraph element class

Last updated:

Released under the MIT License.