feat(activity): implement UTF-8 Braille sparkline renderer #300

Merged
fuzzy merged 1 commit from phase03-renderer into main 2026-07-07 09:38:52 +00:00
Owner

What

Add internal/activity/renderer.go with the core Braille sparkline renderer.

API

  • BrailleSparkline(values) — takes []int, returns UTF-8 sparkline string using Braille Pattern characters (U+2800-U+28FF)
  • normalize(value, min, max) — maps a value to 0-7 based on dataset range
  • minMax(values) — finds min/max of a slice

Levels

8 vertical levels (0-7) mapped to visually progressive Braille characters:

Level Char Description
0 Empty / minimum
1 Lowest
2
3
4
5
6
7 Highest
  • Empty data returns "no data" placeholder
  • Single/flat values normalize to level 0

References: #204, #200, #201, #202, #203

Testing

  • 20 subtests: empty input (nil and empty slice), single value, flat data, rising sequence, falling sequence, normalization (7 cases), minMax (5 cases), example char count
  • golangci-lint run ./internal/activity/ — 0 issues
  • go test ./internal/activity/ — all pass
## What Add `internal/activity/renderer.go` with the core Braille sparkline renderer. ### API - **BrailleSparkline(values)** — takes `[]int`, returns UTF-8 sparkline string using Braille Pattern characters (U+2800-U+28FF) - **normalize(value, min, max)** — maps a value to 0-7 based on dataset range - **minMax(values)** — finds min/max of a slice ### Levels 8 vertical levels (0-7) mapped to visually progressive Braille characters: | Level | Char | Description | |-------|------|-------------| | 0 | ` ` | Empty / minimum | | 1 | `⢀` | Lowest | | 2 | `⢂` | | | 3 | `⢄` | | | 4 | `⣄` | | | 5 | `⣆` | | | 6 | `⣇` | | | 7 | `⣿` | Highest | - Empty data returns `"no data"` placeholder - Single/flat values normalize to level 0 References: #204, #200, #201, #202, #203 ## Testing - [x] 20 subtests: empty input (nil and empty slice), single value, flat data, rising sequence, falling sequence, normalization (7 cases), minMax (5 cases), example char count - [x] `golangci-lint run ./internal/activity/` — 0 issues - [x] `go test ./internal/activity/` — all pass
feat(activity): implement UTF-8 Braille sparkline renderer
All checks were successful
Test and Release / lint (pull_request) Successful in 3m45s
Test and Release / test (pull_request) Successful in 9m42s
e0a1eb80fb
- BrailleSparkline(): render int values as UTF-8 Braille pattern
  sparkline using 8 level characters (U+2800-U+28FF)
- normalize(): map values to 0-7 via min/max per graph
- minMax(): find range across dataset
- Empty data returns placeholder string
- 20 subtests covering: empty input, single value, flat data,
  rising/falling sequences, normalization edge cases, min/max,
  character count matching design doc spec

Ref: #204, #200, #201, #202, #203
the.auditor left a comment

Review

Result: Approved — no blocking issues.

Summary: Adds internal/activity/renderer.go with Braille sparkline renderer. BrailleSparkline(values) normalizes []int to 8 vertical levels mapped to Braille Pattern characters (U+2800-U+28FF). Helper functions normalize() (linear scaling to 0-7) and minMax() (range finder). Empty data returns "no data" placeholder. ROADMAP2.md updated — Phase 3 top-level items complete.

Non-blocking:

  • #301 — Add godoc for exported BrailleSparkline

Checklist:

  • Correctness: Integer arithmetic normalization correct, min/max logic sound
  • Completeness: All #204 sub-tasks covered — mapping, character selection, normalization, empty placeholder
  • Test coverage: 20 subtests (empty, single, flat, rising, falling, 7 normalize edge cases, 5 minMax cases, example)
  • Performance: strings.Builder with pre-allocation, O(n) per call
  • Maintainability: Clean, simple, well-tested pure functions
## Review **Result: Approved** — no blocking issues. **Summary:** Adds `internal/activity/renderer.go` with Braille sparkline renderer. `BrailleSparkline(values)` normalizes `[]int` to 8 vertical levels mapped to Braille Pattern characters (U+2800-U+28FF). Helper functions `normalize()` (linear scaling to 0-7) and `minMax()` (range finder). Empty data returns `"no data"` placeholder. ROADMAP2.md updated — Phase 3 top-level items complete. **Non-blocking:** - #301 — Add godoc for exported `BrailleSparkline` **Checklist:** - Correctness: ✅ Integer arithmetic normalization correct, min/max logic sound - Completeness: ✅ All #204 sub-tasks covered — mapping, character selection, normalization, empty placeholder - Test coverage: ✅ 20 subtests (empty, single, flat, rising, falling, 7 normalize edge cases, 5 minMax cases, example) - Performance: ✅ strings.Builder with pre-allocation, O(n) per call - Maintainability: ✅ Clean, simple, well-tested pure functions
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-07 09:33:00 +00:00
fuzzy added this to the Steeper project 2026-07-07 09:34:03 +00:00
fuzzy self-assigned this 2026-07-07 09:34:05 +00:00
fuzzy merged commit e0a1eb80fb into main 2026-07-07 09:38:52 +00:00
fuzzy deleted branch phase03-renderer 2026-07-07 09:38:52 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/steeper!300
No description provided.