Add Indicator, Histogram2d, Icicle trace types + layout uirevision (#422)#4
Closed
jqnatividad wants to merge 2 commits into
Closed
Add Indicator, Histogram2d, Icicle trace types + layout uirevision (#422)#4jqnatividad wants to merge 2 commits into
jqnatividad wants to merge 2 commits into
Conversation
… uirevision (plotly#422) Add three new trace types and the layout-level uirevision attribute, with field names verified against the plotly.js v3.7.0 plot-schema.json. - Indicator: KPI number/delta/gauge displays (Gauge, Delta, Number config) - Histogram2d: 2D histogram heatmap (histfunc/histnorm/nbinsx/nbinsy/xbins/ ybins), reusing histogram's Bins/HistFunc/HistNorm and heat_map's Smoothing - Icicle: hierarchical icicle chart (sibling of Treemap/Sunburst) - layout.uirevision: preserve UI state (zoom/pan/selection) across re-renders, complementing the trace-level uirevision added in plotly#421 Includes PlotType variants, re-exports, exact-JSON round-trip tests, doctests, and CHANGELOG entries. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the minimal GaugeAxis (range + a few ticks) with the complete set of 27 attributes plotly.js exposes on indicator.gauge.axis: tick mode/placement (tickmode/nticks/tick0/dtick/tickvals/ticktext), tick styling (ticks/ticklen/tickwidth/tickcolor/tickangle/tickfont), label controls (showticklabels/tickprefix/ticksuffix + their ArrayShow flags), exponent and number formatting (showexponent/exponentformat/minexponent/separatethousands/ tickformat/tickformatstops/ticklabelstep), and labelalias. Reuses existing enums (common::TickMode/ExponentFormat/TickFormatStop, layout::ArrayShow/TicksDirection) rather than layout::Axis, which carries ~70 attributes (grid lines, spikes, range sliders, subplot anchoring) that a gauge axis does not support and would silently serialize as ignored JSON. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
|
Superseded by the upstream PR against plotly/plotly.rs: plotly#423 |
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.
Implements the four additions from plotly#422, field-verified against the plotly.js v3.7.0
plot-schema.json.What's added
Indicator— KPI number / delta / gauge displays, withMode(number/delta/gauge flaglist),Number,Delta/Direction, and a fullGauge(GaugeAxis,GaugeBar,Step,Threshold).Indicator::new(value)sets onlyvalue, leavingmodeto the plotly.js default (consistent with sibling constructors).Histogram2d— 2D histogram heatmap. Reuseshistogram::{Bins, HistFunc, HistNorm}andheat_map::Smoothing; addshistfunc/histnorm/nbinsx/nbinsy/xbins/ybins/autobinx/autobiny.new(x, y)bins raw samples;new_xyz(x, y, z)takes a pre-computed matrix.Icicle— hierarchical icicle chart (sibling ofTreemap/Sunburst), with icicle-specificTiling(reusingcommon::Orientation), a marker without treemap'spad/corner_radius/depth_fade, plusLeafandRoot.layout.uirevision— preserves UI state (zoom/pan/selection/legend visibility) acrossPlotly.react/newPlotre-renders, complementing the trace-leveluirevisionadded in Backfill common trace attributes for plotly.js 3.7 parity plotly/plotly.rs#421.Notes
GaugeAxiscovers all 27 meaningfulindicator.gauge.axisattributes (tick placement, styling, label/exponent/number formatting,labelalias,tickformatstops), reusingcommon::{TickMode, ExponentFormat, TickFormatStop}andlayout::{ArrayShow, TicksDirection}rather thanlayout::Axis— the latter carries ~70 attributes (grid lines, spikes, range sliders, subplot anchoring) that a gauge axis doesn't support and would silently serialize as ignored JSON.PlotTypevariants (Histogram2d,Icicle,Indicator) serialize viarename_all = "lowercase"; re-exported fromtraces/mod.rsand bothlib.rslists.[Unreleased] → Added.Verification
cargo build -p plotly(default) and--features all— cleancargo test -p plotly --features all— 363 unit + 34 doc tests green (exact-JSON round-trips for each new trace, plus a layoutuirevisiontest)cargo clippy -p plotly --features all --all-targets -- -D warnings -A deprecated— cleancargo +nightly fmt --all— appliedBrowser-render smoke test not run (no chromedriver in this environment); JSON correctness rests on schema-grounded field names + round-trip tests.
🤖 Generated with Claude Code