fix(dataviz): honour start_at, the layout box, and degenerate scales - #148
Closed
LeadcodeDev wants to merge 1 commit into
Closed
fix(dataviz): honour start_at, the layout box, and degenerate scales#148LeadcodeDev wants to merge 1 commit into
LeadcodeDev wants to merge 1 commit into
Conversation
Eight confirmed findings across the data components, plus the same defects found by the audit in files the workstream did not own. Five components drove their reveal off raw scene time, so a chart with `start_at: 2.0` was already fully drawn when it appeared. They now measure elapsed time from `start_at`, matching `Counter::ramp_progress`. The same bug in `gauge` and `dot_map` is fixed here rather than left for a later pass — it is one defect in seven copies. `progress` painted at its declared `width`/`height` instead of the box taffy computed, so a bar inside a sized container ignored its own layout. It now paints at `layout.width`/`layout.height`. `stacked_bar` had no signed extent: negative totals rendered outside the box. Stacks now grow either side of an anchored zero. `heatmap` renormalised its data min→max, so a uniform grid of 5.0 painted identically to a grid of 0.0 and `color_scale` did not mean what the docs say. The scale is now the documented absolute 0..1. A neighbouring bug in `interpolate_color` went with it: `t = 1.0` resolved to the second-to-last colour because the local fraction was recomputed from the clamped segment. A flat sparkline series divided by a floored range, normalising every point to 0 and gluing the line to the bottom edge — it read as "collapsed to zero" rather than "unchanged". Flat series now centre. Fixed in `sparkline` and in the `stat` card that reimplements the same maths. Axis labels were collected with `filter_map`, so one datum without a label shifted every subsequent label onto the wrong bar. Labels now keep one slot per datum. Fixed in `bar`, and in `line` and `waterfall` which carry the identical bug. `treemap` drew its label and value on a single baseline, so the value overprinted the label. Fragments now stack.
Owner
Author
|
Recreated against |
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #142 — Dataviz workstream. Eight confirmed findings, plus the same defects in files the workstream did not own.
The findings
Reveal ignored
start_at.chart,heatmap,sparklineandtreemapdrove their animation off raw scene time, so a component withstart_at: 2.0was already fully drawn the moment it appeared. Now measured fromstart_at, matchingCounter::ramp_progress.progressignored its layout box. It painted at the declaredwidth/heightrather than what taffy computed, so a bar inside a sized container overflowed or under-filled — measured 299px of ink in an 800px box, and a ring centred at (149.5, 9.5) in a 60×60 box.stacked_barhad no signed extent. Negative totals rendered outside the box: ink aty=[292..599]in a 300px-tall box. Stacks now grow either side of an anchored zero, likebaralready did.heatmaprenormalised min→max. A uniform grid of 5.0 painted identically to a grid of 0.0, andcolor_scaledid not mean the absolute 0..1 scale the docs describe. Renormalisation removed.A flat sparkline glued itself to the bottom edge. Dividing by a floored range normalises every point to 0, which reads as "collapsed to zero" rather than "unchanged". Flat series now centre.
Axis labels drifted. Collected with
filter_map, so one datum without a label shifted every subsequent label onto the wrong bar —AAAcentred at 104 above a bar centred at 58.5.treemapoverprinted. Label and value shared one baseline. Fragments now stack.Same bug, other files — fixed here rather than deferred
The workstream owned seven files; three of these defects live in files it did not. Fixing only the owned copies would have left an identical bug behind a green test suite, so they were applied at integration:
gauge.rs,dot_map.rsprogress_atignoringstart_atchart/line.rs(×2),chart/waterfall.rsfilter_maplabel driftstat.rsTwo things found beyond the brief
interpolate_colorresolvedt = 1.0to the second-to-last colour: the local fraction was recomputed from the clamped segment index. Same function, same component, and the adversarial verifier had already produced the evidence — fixed alongside.A defensive
.max(0.0)on the circular-progress radius: it became reachable only once the ring started honouring its real layout box, which can now be arbitrarily small where the declared defaults never were.Structural note, not addressed here
progress_atnow exists in seven near-identical copies (Counter,Chart,Heatmap,Sparkline,Treemap,Gauge,DotMap), and the flat-series scale in three. The rule of three is well past — a crate-levelramp_progress(start_at, duration, time)would stop the next component reintroducing the same defect. Deliberately not done in this PR: it is a refactor across eight files and would bury sixteen bug fixes under it. Filed as follow-up work on #142.Verification
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace— 752 passed, 0 failed, re-run by the orchestrator on the integrated tree. Every fix written red first; the failure output for each is recorded in the workstream report.