feat(traces): add Funnel trace type#432
Open
jqnatividad wants to merge 1 commit into
Open
Conversation
jqnatividad
force-pushed
the
feat/funnel-trace
branch
from
July 25, 2026 16:09
2bb5607 to
53f5cfd
Compare
plotly.js has shipped the `funnel` trace since well before the bundled 3.7.0 build — only the Rust wrapper was missing. `funnel` is bar-like and cartesian, so unlike `funnelarea` (domain-based, pie-like, out of scope here) it composes with subplot grids and static image export. Field set follows `Bar`, filtered to the attributes plotly.js actually declares for `funnel`: `offset` and `width` are scalar-only (`arrayOk: false` in the schema) and there is no `base`, error bars, calendars or point selection. `textinfo` is a plain `String` because plotly.js takes a `+`-joined flaglist; this follows the existing precedent in `pie.rs` rather than enumerating the combinations. Also adds the layout-level `funnelmode`/`funnelgap`/`funnelgroupgap` attributes with a `FunnelMode` enum, mirroring the existing waterfall/violin/box mode fields — without `funnelmode`, stacked and grouped multi-trace funnels are unreachable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jqnatividad
force-pushed
the
feat/funnel-trace
branch
from
July 25, 2026 16:17
53f5cfd to
0820c33
Compare
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.
What
Adds the
Funneltrace type, plus the layout-levelfunnelmode/funnelgap/funnelgroupgapattributes and aFunnelModeenum.The bundled
plotly.min.jshas registeredfunnelall along:so this is a pure Rust-wrapper addition — no JS work, no bundle bump. Because
funneliscartesian, it composes with subplot grids and with static image export.Field set
Modelled on
Bar, filtered to what plotly.js actually declares forfunnel:offsetandwidtharearrayOk: falsein the schema, so they are scalarOption<f64>rather thanDim<f64>.base, error bars, calendars, or point selection —funnel'ssupplyDefaultssetsmoduleHasSelected: falseand the attribute block has no equivalents.textinfoisOption<String>. plotly.js takes a+-joined flaglist (label|text|percent initial|percent previous|percent total|value, plusnone), and enumerating the combinations the wayHoverInfodoes would explode. This follows the existing precedent inpie.rs, which declarestext_info: Option<String>and documents.text_info("label+percent"). Happy to switch to a typed flaglist if you'd prefer one.Connectoris a new small struct (visible/line/fillcolor) in the same module; nothing equivalent existed, sincewaterfallis not implemented.Layout attributes
funnelmode/funnelgap/funnelgroupgapare included alongside the existingwaterfallmode/violinmode/boxmodefields. Withoutfunnelmode, stacked and grouped multi-trace funnels are unreachable. This mirrorsWaterfallMode, which already exists without a corresponding trace.Out of scope
funnelareais a different trace — domain-based and pie-like rather than cartesian — and is deliberately not included here.Tests
Funnelasserting the serialized JSON.default_funnel,serialize_funnel(all fields),serialize_connector, and a horizontal-funnel-in-a-subplot case coveringorientation, multi-flagtextinfo, andxaxis/yaxisplacement.serialize_funnel_modeinlayout::modes.cargo test -p plotly --features all,cargo clippy --features all -- -D warnings -A deprecated, andcargo +nightly fmt --all -- --checkall pass.