Charts¶
The charts sub-package provides terminal chart components for data visualization. All chart types implement Component and Themed.
Chart Types¶
Bar¶
Horizontal or vertical bar chart with labeled categories.
bar := charts.NewBar(charts.BarOpts{
Data: []charts.BarItem{{Label: "Go", Value: 42}, {Label: "Rust", Value: 28}},
Height: 12,
})
Line¶
Line chart with optional multi-series support.
line := charts.NewLine(charts.LineOpts{
Series: []charts.Series{{Label: "CPU", Data: cpuData}},
Height: 10,
Width: 60,
})
Ring¶
Donut/ring chart for proportional data.
ring := charts.NewRing(charts.RingOpts{
Segments: []charts.Segment{{Label: "Used", Value: 72}, {Label: "Free", Value: 28}},
Radius: 6,
})
Gauge¶
Single-value gauge with configurable range.
Heatmap¶
Grid heatmap for matrix data.
heatmap := charts.NewHeatmap(charts.HeatmapOpts{
Data: matrix,
XLabels: []string{"Mon", "Tue", "Wed", "Thu", "Fri"},
YLabels: []string{"Morning", "Afternoon", "Evening"},
})
Sparkline (Root Package)¶
The root blit package also provides an inline sparkline for embedding in table cells or status bars:
Example¶
API Reference¶
Full API documentation: pkg.go.dev/github.com/blitui/blit/charts