Skip to content

feat(viz): KPI overview row, icicle charts & layout uirevision (plotly.rs #423)#4184

Merged
jqnatividad merged 4 commits into
masterfrom
viz-kpi-icicle-uirevision
Jul 11, 2026
Merged

feat(viz): KPI overview row, icicle charts & layout uirevision (plotly.rs #423)#4184
jqnatividad merged 4 commits into
masterfrom
viz-kpi-icicle-uirevision

Conversation

@jqnatividad

Copy link
Copy Markdown
Collaborator

Adopts the stacked dathere/plotly branch feature/trace-type-additions (plotly/plotly.rs#423) — a strict superset of the prior pin (0 behind, keeps every MapLibre map trace viz uses) — and puts the new API to work.

What's new

KPI overview row (viz smart)

A full-width band of plotly Indicator tiles leads every HTML dashboard:

  • A built-in completeness gauge (non-null cells / total cells — an inherently 0–100% scale, no LLM needed) plus the headline numeric measures (sum for extensive, mean for intensive). Measure tiles are derived from the columns that earned a distribution panel, so they stay consistent with the charts at any data size.
  • Dictionary-driven gauges & deltas via a new x-qsv.gauge_range / x-qsv.target seam in the --dictionary schema:
    • a gauge is drawn only when the dictionary supplies a range and that range actually contains the observed value (a gauge_range also forces the mean, so it lands in-scale) — otherwise it falls back to a plain number;
    • a "vs target" delta when the dictionary supplies a target — a semantically-justified goal, never a fabricated prior-period baseline.
  • Renders in both the inline and typed-grid paths, and is invisible to --max-charts, the panel-count notices, and the render-path thresholds (it's a domain band, not a cartesian subplot). HTML-only.

Note: teaching describegpt to emit gauge_range/target is deferred to a follow-up. Until then, the hints are consumed from any dictionary that carries them (hand-authored now), and completeness + number tiles work with no dictionary.

Icicle charts

New viz icicle subcommand and --hierarchy-style icicle — a level-aligned sibling of treemap/sunburst.

Layout uirevision

Set centrally in apply_theme, so user zoom/pan/selection/legend state survives the Plotly.newPlot re-renders that inject the fullscreen modebar button and recolor on theme toggle. (The trace-level uirevision from #421 doesn't cover this — the layout-level attribute was still missing upstream and is added in #423.)

Dropped as a phantom

z_order — every cartesian smart panel is single-trace, and the only overlaps are on map subplots where cartesian zorder is ignored by plotly.

Testing

  • cargo test -F all_features viz271 pass (5 tests added/updated, incl. icicle standalone, KPI row, and dictionary gauge/delta).
  • cargo clippy clean (no new warnings), cargo +nightly fmt.
  • Verified in-browser: KPI row renders with gauges, deltas, and big numbers; help docs regenerated.

🤖 Generated with Claude Code

…y.rs #423)

Adopt dathere/plotly branch `feature/trace-type-additions` (PR plotly/plotly.rs#423,
a strict superset of the prior pin) and use the new API in `viz`:

- viz smart now leads with a full-width KPI overview row of plotly `Indicator`
  tiles: a built-in completeness gauge plus the headline numeric measures (sum for
  extensive, mean for intensive). A measure becomes a gauge when the data
  dictionary supplies a validated `x-qsv.gauge_range` (drawn only when the range
  actually contains the observed value; a range also forces the mean so it lands
  in-scale) and a "vs target" delta when it supplies `x-qsv.target` (a
  semantically-justified goal, never a fabricated prior-period baseline). Renders
  in both the inline and typed-grid paths and stays invisible to --max-charts,
  the panel-count notices, and the render-path thresholds (it is a domain band,
  not a cartesian subplot). HTML-only.

- Add `viz icicle` subcommand and `--hierarchy-style icicle`, a level-aligned
  sibling of treemap/sunburst.

- Set layout-level `uirevision` centrally in apply_theme so user zoom/pan/
  selection/legend state survives the Plotly.newPlot re-renders that inject the
  fullscreen modebar button and recolor on theme toggle.

describegpt emission of gauge_range/target is deferred; until then the hints are
consumed from any dictionary that carries them, with completeness + number tiles
working with no dictionary.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

jqnatividad and others added 3 commits July 11, 2026 15:47
…orev #3602)

The leading KPI row is domain-positioned and consumes no cartesian axis, but it
still occupies panel index 0 in `smart_grid_parts`, so `pos = n + 1` labelled the
cartesian panels behind it x2..x9. With exactly MAX_SUBPLOTS (8) cartesian panels
on the typed-grid path the 8th chart landed on x9, which the typed `Layout`
(x1..x8) has no slot for — `assign_typed_axis` silently drops it, orphaning the
trace onto the default axis.

Subtract a one-slot `axis_offset` when the leading panel is the KPI row so the
cartesian axes number x1..x8. The KPI row and geo panels never coexist in this
assembler (geo forces the inline path for HTML; image exports carry no KPI row),
so a single leading offset is sufficient. Adds a regression test that drives the
exact 8-cartesian-panel boundary via `--max-charts 8`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…case

The smart dashboards now lead with a KPI overview row (completeness gauge +
top-measure number tiles); regenerated the 7 affected smart_*.html figures so
they reflect it. Added a dedicated `viz icicle` example to gen_gallery.py so the
new chart type is showcased (gallery is now 38 figures).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…en KPI-row lag (roborev #3604)

The icicle code comment claimed a top-down default, but plotly leaves
tiling.orientation at horizontal ("h") — root on the left, children fanning
right (confirmed in plotly.rs Tiling docs + live render). The gallery
description was already accurate; fixed the misleading code comment instead.

Also documented, per developer deferral, that the LLM-dependent pre-generated
dashboards intentionally lag the KPI/Completeness row until describegpt emits
the gauge_range/target dictionary hints and they can be regenerated in one pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jqnatividad jqnatividad merged commit eefe279 into master Jul 11, 2026
17 checks passed
@jqnatividad jqnatividad deleted the viz-kpi-icicle-uirevision branch July 11, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant