Skip to content

feat(plotly): add reactive strip chart selection support#9012

Closed
axsseldz wants to merge 28 commits intomarimo-team:mainfrom
axsseldz:feat/reactive-plotly-strip
Closed

feat(plotly): add reactive strip chart selection support#9012
axsseldz wants to merge 28 commits intomarimo-team:mainfrom
axsseldz:feat/reactive-plotly-strip

Conversation

@axsseldz
Copy link
Copy Markdown
Contributor

@axsseldz axsseldz commented Apr 3, 2026

📝 Summary

Makes px.strip fully selection-reactive in mo.ui.plotly. Strip charts are go.Box traces under the hood (boxpoints="all", transparent fill), so this PR combines the box and violin implementations from the sibling branches onto one branch.

🔍 Description of Changes

  • Frontend: added type === "box" and type === "violin" to shouldHandleClickSelection.
  • Python: ported the full box and violin implementations (_append_*, _extract_*, _build_* helpers). Strip chart reactivity comes for free through the box path.
  • Tests: violin tests.
  • Example: examples/third_party/plotly/strip_chart.pypx.strip() grouped, go.Box single-trace, and horizontal variants with live stats and mo.ui.table.

Box Selection

strip1

Click Selection

strip2

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

@mscolnick @nojaf

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Apr 13, 2026 4:47am

Request Review

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Apr 3, 2026
@axsseldz axsseldz marked this pull request as ready for review April 3, 2026 13:57
Copilot AI review requested due to automatic review settings April 3, 2026 13:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables selection reactivity for Plotly box/violin traces (and therefore px.strip, which renders as go.Box) in mo.ui.plotly, including click-selection support in the frontend and row-level expansion/extraction on the Python side.

Changes:

  • Frontend: handle click selections for type === "box" and type === "violin".
  • Python: add box/violin selection expansion/extraction helpers and hook them into _convert_value.
  • Add extensive tests plus a new strip-chart example and docs update.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
marimo/_plugins/ui/_impl/plotly.py Adds box/violin selection expansion (click pointNumbers) and range-based extraction logic.
tests/_plugins/ui/_impl/test_plotly.py Adds unit tests covering box/violin/strip selection conversion and extraction helpers.
frontend/src/plugins/impl/plotly/selection.ts Allows click-selection handling for box/violin traces.
frontend/src/plugins/impl/plotly/__tests__/selection.test.ts Adds tests asserting click-selection eligibility for box/violin.
examples/third_party/plotly/strip_chart.py New example demonstrating reactive strip-chart selection workflows.
docs/api/plotting.md Updates documentation of which Plotly chart types support reactive selection.

@mscolnick mscolnick requested review from kirangadhave and removed request for Light2Dark, akshayka and manzt April 3, 2026 18:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

axsseldz and others added 5 commits April 3, 2026 20:01
Resolves conflicts between waterfall (merged to main) and strip/box/violin
additions. Both feature sets are now present: waterfall handlers are
inserted before the box/violin handlers in _convert_value, and all
function definitions are included.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolves conflicts between waterfall (merged to main) and funnel additions.
Both feature sets included: waterfall handlers inserted before funnel handlers
in _convert_value, all function definitions and tests from both branches kept.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
axsseldz and others added 12 commits April 8, 2026 09:02
Merges violin plot and area chart support from main while preserving
box/strip plot additions. `hasAreaTrace` added to TS, both
`_append_box_points_to_selection` and `_append_violin_points_to_selection`
coexist in Python with their full helper function hierarchies.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Syncs strip chart support into box branch so both can merge into main
independently without conflicts. Adds strip chart example, strip test
section, and updated supported-charts documentation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds funnel/funnelarea chart support from feat/reactive-plotly-funnel so
that both branches can merge into main independently without conflicts.
Includes funnel/funnelarea trace types, test cases, and docs updates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The cross-branch merge left two competing implementations of
_append_box_points_to_selection and its helpers, plus duplicate
_build_waterfall_point and _append_map_scatter_points_to_selection.
Python silently used the last definition; pyright caught all six
[no-redef] errors in CI. Removes the dead first copies.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Bundle Report

Changes will increase total bundle size by 12.8kB (0.05%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
marimo-esm 24.84MB 12.8kB (0.05%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: marimo-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/cells-*.js 384 bytes 703.39kB 0.05%
assets/index-*.js 683 bytes 602.15kB 0.11%
assets/index-*.css 290 bytes 362.29kB 0.08%
assets/dist-*.js 17 bytes 276 bytes 6.56% ⚠️
assets/dist-*.js -33 bytes 104 bytes -24.09%
assets/dist-*.js -62 bytes 102 bytes -37.8%
assets/dist-*.js 52 bytes 387 bytes 15.52% ⚠️
assets/dist-*.js -32 bytes 137 bytes -18.93%
assets/dist-*.js 220 bytes 403 bytes 120.22% ⚠️
assets/dist-*.js -9 bytes 160 bytes -5.33%
assets/dist-*.js 65 bytes 169 bytes 62.5% ⚠️
assets/dist-*.js -239 bytes 164 bytes -59.31%
assets/dist-*.js -52 bytes 335 bytes -13.44%
assets/dist-*.js 35 bytes 137 bytes 34.31% ⚠️
assets/dist-*.js 40 bytes 177 bytes 29.2% ⚠️
assets/dist-*.js 155 bytes 259 bytes 149.04% ⚠️
assets/dist-*.js -7 bytes 176 bytes -3.83%
assets/dist-*.js -73 bytes 104 bytes -41.24%
assets/dist-*.js -56 bytes 104 bytes -35.0%
assets/dist-*.js 65 bytes 169 bytes 62.5% ⚠️
assets/dist-*.js 7 bytes 183 bytes 3.98%
assets/dist-*.js -93 bytes 183 bytes -33.7%
assets/JsonOutput-*.js -1 bytes 336.29kB -0.0%
assets/edit-*.js -42.36kB 329.61kB -11.39%
assets/layout-*.js 56.26kB 185.91kB 43.39% ⚠️
assets/slides-*.js 360 bytes 116.37kB 0.31%
assets/panels-*.js -3.15kB 45.36kB -6.5%
assets/state-*.js 192 bytes 24.05kB 0.8%
assets/RenderHTML-*.js 60 bytes 5.01kB 1.21%
assets/button-*.js 93 bytes 3.93kB 2.43%

Files in assets/index-*.js:

  • ./src/plugins/impl/plotly/selection.ts → Total Size: 7.39kB

@Light2Dark
Copy link
Copy Markdown
Collaborator

@axsseldz , im guessing the original PR implemented features that were in all 3 PRs. Is there anything left? We can close this PR.

@axsseldz
Copy link
Copy Markdown
Contributor Author

@axsseldz , im guessing the original PR implemented features that were in all 3 PRs. Is there anything left? We can close this PR.

oh yeah my bad, these changes are already implemented, i'll close this PR and move on to the next changes i mentioned(:

@axsseldz axsseldz closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants