Terminal charts for SugarCraft
Sparkline, Bar, Line, Heatmap, Scatter, TimeSeries, Streamline, Waveline, OHLC, plus inline image rendering via Sixel / Kitty / iTerm2 protocols. Auto-detects terminal capability.
composer require sugarcraft/sugar-charts
use SugarCraft\Charts\Sparkline\Sparkline;
use SugarCraft\Charts\BarChart\BarChart;
use SugarCraft\Charts\LineChart\LineChart;
echo Sparkline::new([1, 3, 2, 8, 5, 4, 7, 6], 8)->view() . PHP_EOL;
// โโโโโ
โโโ
echo BarChart::new(
[['cpu', 0.7], ['mem', 0.4], ['disk', 0.9]], 20, 5
)->view() . PHP_EOL;
echo LineChart::new([1, 4, 2, 8, 6, 3, 7], 30, 6)->view();
| Class | Method | Description |
|---|---|---|
| Sparkline | new(data, width) | Create sparkline chart |
| Sparkline | view() | Render sparkline |
| BarChart | new(data, width, height) | Create bar chart |
| BarChart | view() | Render bar chart |
| LineChart | new(data, width, height) | Create line chart |
| LineChart | view() | Render line chart |
| Heatmap | new(data, width, height) | Create heatmap |
| Canvas | new(width, height) | Create chart canvas |
VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.