charmbracelet / charmbracelet/bubbles

Proposal: Terminal charts library (charm-charts)

Open
#925 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
8.9k
Forks
457
Avg merge
1d 18h
Merged PRs (30d)
5

Description

## Problem

Building dashboards and data visualizations in Bubble Tea requires either:
- External libraries (termui, ntcharts) that don't integrate with lipgloss styling
- Manual Unicode block character manipulation
- No official solution from the Charm ecosystem

With the rise of CLI dashboards (lazydocker, k9s, btop), there's clear demand for chart components.

## Proposed Solution

**charm-charts** — terminal chart components styled with lipgloss.

### Sparkline
```go
data := []float64{4, 2, 7, 3, 8, 5, 9, 1, 6}
spark := charmcharts.NewSparkline(data).
Width(30).Height(3).
Style(lipgloss.NewStyle().Foreground(lipgloss.Color("212")))
// ▃▁▆▂▇▄█ ▅
```

### Bar Chart
```go
chart := charmcharts.NewBarChart(labels, values).
Width(50).Horizontal().
BarStyle(lipgloss.NewStyle().Foreground(lipgloss.Color("99")))
// Go ████████████████████ 85.0
// Rust ████████████████ 72.0
// Python ████████████████████████ 95.0
```

### Progress Bar
```go
bar := charmcharts.NewProgressBar(0.73).Width(30).Label("Upload")
// Upload ██████████████████████░░░░░░░░ 73%
```

### Features
- **Sparkline** — 1-8 row height, auto-scaling, data resampling
- **Bar Chart** — horizontal/vertical, labels, value display
- **Progress Bar** — custom fill/empty chars, percentage display
- Fluent builder API, lipgloss styling, charm-themes integration

## Working POC

https://github.com/junhinhow/charm-charts

Bilingual docs (EN/PT-BR).

## Questions

1. Would charts fit as a bubbles component or standalone package?
2. Interest in a Bubble Tea \`Model\` variant for real-time updating charts?
3. Should pie charts and line charts be added?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.