feat: add Treemap and Sunburst trace types#1
Open
jqnatividad wants to merge 3 commits into
Open
Conversation
Add hierarchical Treemap and Sunburst traces, mirroring the existing Pie trace pattern: - Treemap<V>: labels/parents/values hierarchy with BranchValues, plus Tiling (Packing) and PathBar (Side) helper structs - Sunburst<V>: same hierarchy plus Leaf, rotation and inside_text_orientation - New Treemap/Sunburst PlotType variants and top-level re-exports - treemapcolorway/extendtreemapcolors Layout options - Unit tests, doctests, basic_charts examples and book pages Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the shared common::Marker on Treemap with a treemap-specific
Marker exposing the treemap-only attributes: pad (Pad{t,l,r,b}),
corner_radius, and depth_fade (true/false/"reversed"). The shared
color/colorscale/colorbar/line/pattern machinery is retained, and the
scatter-only fields (size, symbol, ...) that don't apply to treemaps are
dropped. Showcased in the styled_treemap example.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Adds two hierarchical trace types —
TreemapandSunburst— to theplotlycrate, following the existingPietrace pattern.Library
Treemap<V>(plotly/src/traces/treemap.rs):labels/parents/valueshierarchy withbranch_values,count,level,max_depth,domain, sharedMarker, full text/hover field set, plus treemap-specificTiling(withPacking) andPathBar(withSide) helper structs and a sharedBranchValuesenum.Sunburst<V>(plotly/src/traces/sunburst.rs): same hierarchy/text/hover set plusLeaf(opacity),rotation, andinside_text_orientation.PlotType::Treemap/PlotType::Sunburstvariants and top-level re-exports (plotly::Treemap,plotly::Sunburst, and thetreemap/sunburstmodules).Layoutoptionstreemapcolorway/extendtreemapcolors(mirroring the existing sunburst pair).Tests, examples & docs
examples/basic_charts(basic_treemap,styled_treemap,basic_sunburst,styled_sunburst).treemap_charts.mdandsunburst_charts.md, linked inSUMMARY.mdand the basic-charts overview table.Verification
cargo test -p plotly— new unit tests + doctests pass (pre-existing browser static-export tests are unaffected).cargo clippy --features ... -- -D warningsclean (lib + examples).cargo +nightly fmt --allapplied to both workspaces.Notes
marker.pad/cornerradius/depthfade(treemap-only) are not yet exposed — documented in theTreemapdoc comment; the sharedMarkercovers colors/colorscale/colorbar/line.CHANGELOG.mdentry is included (the working-tree edit was reverted intentionally); happy to add one referencing this PR's number.🤖 Generated with Claude Code