Skip to content

feat(viz): adopt plotly.js 3.6.0 attributes (richer OHLC hover, radial sunburst text, unified hover)#4085

Merged
jqnatividad merged 3 commits into
masterfrom
viz-plotly-3.6-attributes
Jun 27, 2026
Merged

feat(viz): adopt plotly.js 3.6.0 attributes (richer OHLC hover, radial sunburst text, unified hover)#4085
jqnatividad merged 3 commits into
masterfrom
viz-plotly-3.6-attributes

Conversation

@jqnatividad

Copy link
Copy Markdown
Collaborator

What

Upgrades the embedded plotly to plotly.js 3.6.0 (dathere fork branch feat/treemap-sunburst-traces @ aeb1e59, tracking upstream plotly/plotly.rs#406) and adopts three new additive, non-breaking attributes in viz.

Changes

src/cmd/viz.rs

  • Candlestick/OHLC hover_template (build_candlestick) — a clean Open/High/Low/Close tooltip with <extra></extra> to suppress the trace-name box, plus a defensive hover_template_fallback("-") (financial traces have known per-point hover-variable gaps). The x/date is intentionally left to the unified-hover header.
  • Sunburst inside_text_orientation(Orientation::Radial) (hierarchy_trace) — label+value+percent runs along each ring's spoke, keeping deep-path sectors legible. Applies to both the standalone viz sunburst subcommand and the viz smart hierarchy panel (shared builder).
  • x unified hover (Layout::hover_mode(HoverMode::XUnified)) — one tooltip per x across series, scoped to ordered-x chart kinds (line, candlestick, ohlc) at the build_layout call site. Excludes scatter/bar/box; the smart dashboard builds its own layout and is untouched.

Galleryexamples/viz/gen_gallery.py CDN pin → 3.6.0; regenerated gallery.html + smart iframe pages so the figures reflect 3.6.0 and the new attributes.

tests/test_viz.rs — extended viz_candlestick / viz_ohlc / viz_sunburst_standalone; added viz_line_unified_hover (asserts line gets x unified while scatter does not).

Skipped from the candidate set: treemap depth_fade (negligible on qsv's 2-level smart treemaps).

Verification

  • cargo build -F all_features clean; 126 viz tests pass; cargo clippy clean (the lone slice-index warning is pre-existing geo code, untouched here).
  • Runtime hover check of the one risk: candlestick %{open}/%{high}/%{low}/%{close} resolve to real values in a browser (header Mar 12, 2025, Open: 104.06 / High: 108.55 / Low: 101.85 / Close: 107.43).
  • Regenerated gallery renders with Plotly 3.6.0, 22 inline + 54 iframe plots, 0 empty figures; all three attributes embedded.

Notes

  • Depends on the unmerged dathere plotly fork branch (pinned in Cargo.lock). The patch comment tracks dropping it once fetch: report improvements #406 is merged & released.
  • The two LLM-dependent smart_dict_* gallery pages are reused as-is (no LLM run), so their sunbursts pick up insidetextorientation only on a future LLM regeneration; the standalone and smart sunburst figures already have it.

🤖 Generated with Claude Code

…l sunburst text, unified hover)

Upgrades the dathere plotly fork pin to its plotly.js 3.0.1 -> 3.6.0 branch
(feat/treemap-sunburst-traces @ aeb1e59, upstream PR plotly/plotly.rs#406) and
adopts three new additive, non-breaking attributes in `viz`:

- Candlestick/OHLC `hover_template`: clean Open/High/Low/Close readout with
  `<extra></extra>` to drop the trace-name box, plus a defensive
  `hover_template_fallback` (financial traces have known hover-variable gaps).
- Sunburst `inside_text_orientation(Radial)`: label+value+percent runs along
  each ring's spoke so deep-path sectors stay legible (standalone + smart panel).
- `x unified` hover (Layout `hover_mode`) scoped to ordered-x chart kinds
  (line, candlestick, ohlc) — one tooltip per x across series. Excludes
  scatter/bar/box; the smart dashboard builds its own layout and is untouched.

Regenerates the example gallery (now CDN plotly 3.6.0) so the figures reflect
the new attributes. Adds/extends tests for all three (viz_candlestick,
viz_ohlc, viz_sunburst_standalone, new viz_line_unified_hover).

Verified: 126 viz tests pass; clippy clean; candlestick hover confirmed to
resolve %{open}/%{high}/%{low}/%{close} at runtime in a browser.

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 2 commits June 27, 2026 09:47
`Sunburst::inside_text_orientation(Orientation::Radial)` serialized to
`"insidetextorientation":"r"` — the shared `Orientation` enum's
single-letter code (correct for bars/boxes/legends/sankey, wrong here).
plotly.js 3.6.0 only accepts the full words
`horizontal`/`radial`/`tangential`/`auto` and silently coerces `"r"` to
the default `"auto"`, so the radial sunburst text was a no-op and the
test locked in the invalid value.

Fix in the dathere plotly fork by adding a sunburst-specific
`InsideTextOrientation` enum that serializes to full words, leaving the
general `Orientation` enum untouched. Re-pin `Cargo.lock` at the fork
branch tip (3c185f8), switch the call site, drop the now-unused
`Orientation` import, update the test to assert `"radial"`, and
regenerate the gallery.

Browser-verified against plotly.js 3.6.0: `_fullData` resolves the
orientation to `"radial"` (not coerced to `"auto"`) and labels render
radially along each ring's spoke.

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

Refresh the two LLM-dependent smart-dashboard gallery artifacts
(smart_dict_treemap.html, smart_dict_sunburst.html) from the current
qsv binary via describegpt `--dictionary infer` (local LM Studio,
google/gemma-3-27b), and rebuild gallery.html to reference them.

The sunburst dict figure now carries the valid
`"insidetextorientation":"radial"` attribute (was the no-op `"r"`);
both pages embed plotly.js 3.6.0 from the CDN. Browser-verified: 14 and
5 panels respectively, 0 render errors, sunburst resolves to radial.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jqnatividad jqnatividad merged commit cce5a05 into master Jun 27, 2026
19 checks passed
@jqnatividad jqnatividad deleted the viz-plotly-3.6-attributes branch June 27, 2026 14:18
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