Commit f5e9480
authored
fix(dashboard): fix table widget rendering and timeseries bar chart width (#584)
## Summary
- **Table widgets** rendered raw markdown pipe syntax (`| COL | COL |`)
instead of formatted text — rewrote `renderTableContent()` with direct
column alignment
- **Timeseries bar charts** were missing the last 2+ bars due to
`Math.floor` truncation in bar width — fixed with Bresenham-style
remainder distribution
## Table widget fixes
- Replaced `mdTableHeader()`/`mdRow()` (raw CommonMark that was never
passed through `renderMarkdown()`) with width-aware aligned text columns
- Columns expand to fill the full widget width (last column absorbs
surplus)
- Numeric columns and their headers are right-aligned
- Compact number formatting (10K, 1.5M) kicks in when columns overflow
`innerWidth`
- Per-cell truncation with ellipsis for narrow widgets
- Extracted `measureTableColWidths()`, `compactifyTableNumbers()`,
`fitTableCell()` helpers to stay under cognitive complexity limit
## Bar chart fix
`Math.floor(chartWidth / sampled.length)` truncates `barWidth`, making
`barWidth * count < chartWidth`. The X-axis rendered at full width,
creating a visible gap. Fix: compute `remainder = chartWidth - barWidth
* count` and give the first `remainder` bars one extra column. Applied
to both `renderTimeBarRows` (single-series) and
`renderStackedTimeBarRows` (multi-series).1 parent c466a19 commit f5e9480
5 files changed
Lines changed: 645 additions & 76 deletions
File tree
- src/lib
- api
- formatters
- test/lib
- api
- formatters
0 commit comments