Skip to content

enable single-click selection for reactive Plotly charts#8782

Merged
mscolnick merged 3 commits into
marimo-team:mainfrom
axsseldz:fix/chart-click-missing-values
Apr 2, 2026
Merged

enable single-click selection for reactive Plotly charts#8782
mscolnick merged 3 commits into
marimo-team:mainfrom
axsseldz:fix/chart-click-missing-values

Conversation

@axsseldz

Copy link
Copy Markdown
Contributor

📝 Summary

Follow-up to #8490 and #8489

Add single-click selection support for Plotly scatter, scattergl, and histogram charts.

🔍 Description of Changes

  • updated the Plotly frontend plugin to treat single clicks on supported traces as selections
  • preserved existing box and lasso selection behavior
  • added a shared selection helper for click payload extraction
  • added focused frontend tests for click selection behavior across supported Plotly trace types
  • updated the Plotly docs to mention histogram support

📋 Checklist

  • I have read the contributor guidelines.
  • 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).
  • Tests have been added for the changes made.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Pull request title is a good summary of the changes - it will be used in the release notes.

CC: @mscolnick @nojaf

Copilot AI review requested due to automatic review settings March 19, 2026 22:52
@vercel

vercel Bot commented Mar 19, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Apr 2, 2026 7:55am

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Enables single-click selection reactivity for additional Plotly trace types by extracting click payloads into the same selection shape used by box/lasso selection, and updates related frontend/docs.

Changes:

  • Added shared Plotly selection utilities (extractClickSelection, extractPoints, extractIndices) and wired onClick to produce selection payloads for supported traces.
  • Updated Plotly plugin selection handling to use the shared helpers for both click and box/lasso selection flows.
  • Adjusted Slider input behavior/tests and updated Plotly docs to mention histogram support.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/plugins/impl/plotly/selection.ts New helper module for extracting click-selection payloads and normalizing point/index data.
frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx Uses the new helpers to support click-based selection and to normalize indices for selection events.
frontend/src/plugins/impl/SliderPlugin.tsx Changes NumberField path to always call setValue (regardless of debounce).
frontend/src/plugins/impl/tests/SliderPlugin.test.tsx Adds/updates slider tests around debounce and editable input behavior.
docs/api/plotting.md Updates docs to mention histogram support in reactive Plotly selections.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/plugins/impl/plotly/selection.ts
Comment thread frontend/src/plugins/impl/__tests__/SliderPlugin.test.tsx
Comment thread frontend/src/plugins/impl/SliderPlugin.tsx
Comment thread docs/api/plotting.md Outdated
@mscolnick

Copy link
Copy Markdown
Contributor

@axsseldz sorry we missed the review on this. is this good for a review still?

@axsseldz

axsseldz commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

@axsseldz sorry we missed the review on this. is this good for a review still?

hey @mscolnick ill resolve the conflicts and let you know asap(:

pranay0703 and others added 2 commits April 1, 2026 19:39
marimo-team#8682)

When `debounce=True` and `include_input=True` are set on a slider,
editing the numeric input does not trigger cell execution. This fixes
the issue by forcing the NumberField's onChange to immediately setValue
regardless of if the parent slider is configured with debounce, since
numeric input edit events are explicitly requested by the user.

Fixes marimo-team#8677

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 7 out of 7 changed files in this pull request and generated no new comments.

@mscolnick mscolnick merged commit 750fb85 into marimo-team:main Apr 2, 2026
41 of 44 checks passed
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.22.1-dev28

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.

4 participants