2.6 KiB
Charting architecture
Decision: one chart engine for all live metrics
Engine: github.com/go-analyze/charts (pure Go, no CGO, SVG output)
Theme: grafana (dark background, coloured lines)
All live metrics charts in the web UI are server-side SVG images served by Go
and polled by the browser every 2 seconds via <img src="...?t=now">.
There is no client-side canvas or JS chart library.
Rule: live charts must be visually uniform
Live charts are a single UI family, not a set of one-off widgets. New charts and changes to existing charts must keep the same rendering model and presentation rules unless there is an explicit architectural decision to diverge.
Default expectations:
- same server-side SVG pipeline for all live metrics charts
- same refresh behaviour and failure handling in the browser
- same canvas size class and card layout
- same legend placement policy across charts
- same axis, title, and summary conventions
- no chart-specific visual exceptions added as a quick fix
Current default for live charts:
- legend below the plot area when a chart has 8 series or fewer
- legend hidden when a chart has more than 8 series
- 10 equal Y-axis steps across the chart height
- 1400 x 360 SVG canvas with legend
- 1400 x 288 SVG canvas without legend
- full-width card rendering in a single-column stack
If one chart needs a different layout or legend behaviour, treat that as a design-level decision affecting the whole chart family, not as a local tweak to just one endpoint.
Why go-analyze/charts
- Pure Go, no CGO — builds cleanly inside the live-build container
- SVG output — crisp at any display resolution, full-width without pixelation
- Grafana theme matches the dark web UI colour scheme
- Active fork of the archived wcharczuk/go-chart
SAT stress-test charts
The drawGPUChartSVG function in platform/gpu_metrics.go is a separate
self-contained SVG renderer used only for completed SAT run reports
(HTML export, burn-in summaries). It is not used for live metrics.
Live metrics chart endpoints
| Path | Content |
|---|---|
GET /api/metrics/chart/server.svg |
CPU temp, CPU load %, mem load %, power W, fan RPMs |
GET /api/metrics/chart/gpu/{idx}.svg |
GPU temp °C, load %, mem %, power W |
Charts are 1400 × 360 px SVG when the legend is shown, and 1400 × 288 px when
the legend is hidden. The page renders them at width: 100% in a
single-column layout so they always fill the viewport width.
Ring buffers
Each metric is stored in a 120-sample ring buffer (2 minutes of history at 1 Hz). Buffers are per-server or per-GPU and grow dynamically as new GPUs appear.