-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
ltl's bar graph column layout evolved from a simple 3-column system to a complex multi-column layout supporting up to 9 visible columns, vertical separators, compound columns (legend), and conditional visibility. The implementation grew incrementally, resulting in 5 overlapping data structures (%graph_width, @printed_column_widths, @printed_column_names, @printed_column_spacing, and two competing count variables) populated piecemeal across ~170 lines. Graph widths use hardcoded percentage tables (65/35, 62/21/17, etc.) that must be manually authored for each column count.
This causes bugs when adding columns (#27), blocks new column types (#26), and makes the rendering code fragile through cumulative $printed_chars tracking.
Solution
Replace the fragmented layout system with a unified column layout engine where each column is defined once with all its properties: name, sizing type, width, spacing, visibility, color, and rendering behavior.
Key Requirements
- Column types: Fixed (timestamp, latency), content-driven (legend), proportional (all graph columns), separator (
│), and compound (legend as counts + spacing + rates sub-columns with spanning header) - Algorithmic width distribution: Replace hardcoded percentage tables with a focus/secondary algorithm that works for any column count
- First-class visibility: Each column carries a visible flag; hiding triggers automatic redistribution
- Fill-to-width rendering: Each column fills its allocated width independently, eliminating
$printed_charstracking - Color as column property: Color identity carried in column definition, not derived from position
- Separators as layout elements: Modeled explicitly with adjacency visibility rules
Constraints
- Output must be pixel-identical to current behavior for all option combinations
- No Perl OO/classes — use idiomatic data structures
- No new visual features — pure structural refactor
Detailed Requirements
See features/column-layout-refactor.md for the full requirements document covering all sections: column types, layout engine, headers, separators, colors, legend decomposition, rendering, testing strategy, and risks.
Approach
- Requirements document (this issue + feature file) ✅
- Prototype to validate design
- Iterate on prototype
- Phased implementation
Related Issues
- Blocks Feature: Concurrent session metric calculated and graphed like active threads #26 — Session metric column (adding a new column type should be trivial with the new system)
- Fixes Bug: Character display wraps due to improper width calculation for additional field with -tpa https #27 — Array mismatch bug (root cause eliminated by single source of truth)
- Enables Bug: Consolidate color gradient definitions shared between heatmap and histogram #64 — Color consolidation (column-carries-color approach)