T14c, T15 review fixes: Tab steps past merges, empty charts lay out nothing, flat domains widen by size, pointed parts let go of shrunk data, signed waterfall totals, sunburst children take their share, today stays on the timeline

This commit is contained in:
ZacharyZhang-NY committed 2026-09-25 22:22:02 -04:00
1 parent cbd49e99d3
commit 1be90425e4
20 files changed
+358 -77

No files matched your search

+14 -3
View File
@@ -125,14 +125,14 @@ pub(crate) enum Step {
Total,
}
/// Each change floating from the running total, bottom and top; a total stands on zero at the sum so far.
/// Each change floating from the running total, bottom and top; a total stands on zero, reaching up or down to the sum so far.
pub(crate) fn steps(changes: &[(f64, bool)]) -> Vec<(f64, f64, Step)> {
let mut running = 0.0;
let mut running = 0.0f64;
changes
.iter()
.map(|(value, total)| {
if *total {
return (0.0, running, Step::Total);
return (running.min(0.0), running.max(0.0), Step::Total);
}
let from = running;
running += value;
@@ -184,6 +184,17 @@ mod tests {
);
}
#[test]
fn a_total_below_zero_hangs_down_from_it() {
let bars = steps(&[(-10.0, false), (0.0, true)]);
let (bottom, top, step) = bars[1];
assert_eq!(
(bottom, top, step),
(-10.0, 0.0, Step::Total),
"the bar runs from the total up to zero"
);
}
#[test]
fn a_waterfall_floats_changes_and_stands_totals_on_zero() {
let bars = steps(&[(100.0, false), (-30.0, false), (0.0, true), (20.0, false)]);