published fresh until

Plotly: link filtered charts by stable record IDs

Summary Keep record IDs separate from trace-local point positions, rebuild tooltip arrays with each filter, and propagate a single selection state to both charts. Control reset behavior with selectionrevision

Not for shadcn dashboard layout; see dashboard-shadcn-dashboard-01-block.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: put a stable record ID in each point's customdata, then map selections through that ID before updating another chart.

Short answer

As of November 2026, Plotly.py 7.1.0 release is the reference. Keep one authoritative selected-ID set; each trace has its own ordered ID array and derives its own selected positions. Never reuse positions after filtering. FigureWidget callbacks require an ipywidget context; use Dash for server-side filtering and separately served applications (host boundary).

Choose / don't choose

  • Dash: choose callbacks when filters must query server data or update several graphs; return related figures together from one callback. (Dash graph interactions, callback dependencies).
  • FigureWidget: choose a live notebook for analysis with Python state; use batch_update() for coordinated trace changes (widget application, callback example).
  • Browser-only HTML: choose for embedded data plus JavaScript handlers; don't distribute sensitive server data in the figure.

Not for: shadcn dashboard layout; see dashboard-shadcn-dashboard-01-block.

Settings that matter

Setting or flagValue / defaultApplies toSource
customdataPer-point rows; recipe [record_id, label], built in the same order as x/yPlotly.py current docs, November 2026scatter
hovertemplateRecipe: %{customdata[1]}<br>Value: %{y:.2f}<extra></extra>; retain the ID without displaying itPlotly.py current docs, November 2026hover formatting
selectedpointsCurrent trace-local integer indices; [] selects nothing and styles all points as unselected; None clears selection stylingPlotly.py current docs, November 2026scatter
selectionrevisionselectionrevision controls persistence of user-driven changes in selected points. Keep a stable application revision for unchanged selection semantics; remap explicit indices whenever row order changesPlotly.py current docs, November 2026layout

The revision token controls persistence. (layout reference).

Order of operations

1. Filter the authoritative rows once; derive every chart's x/y, labels and IDs from that same snapshot. 2. Translate the originating event's per-trace points.point_inds through that trace's current IDs. Retain selected IDs, not positions; for each destination trace derive positions whose IDs belong to the selected set. The callback API and scatter reference define these inputs; the ID mapping is application policy. 3. On filter changes, either intersect the selected-ID set with remaining rows or clear it deliberately. Rebuild all arrays, compute new positions, and publish both figures together. With separate Dash callbacks, chain dependent outputs so the downstream callback receives the updated dataset; don't independently read mutable global data (callback sequencing). 4. Reject late events from an older application dataset revision. On clear, set every trace's selectedpoints=None; use a new selectionrevision when reset is intentional.

Known failures and fixes

Error (short quote)CauseFixSource
Please install anywidget to use the FigureWidget classWidget dependency absent from the kernel environmentInstall anywidget in that environment, restart kernel, then recreate widgets; igi-chris reported this dependency failureissue 4996, migration
Selection state does not follow the callback (symptom)Relying on an automatically synchronized Python propertyConsume callback point indices and explicitly own selected-ID state; historical report is not proof of a current regressionissue 1433

Diagnostic: Please install anywidget to use the FigureWidget class

Install anywidget before recreating figures (migration).

Missing

  • The linked source does not confirm: A standalone HTML export cannot run Python callbacks
  • The linked source does not confirm: Updating it cannot repair stale indices.
  • Data volume, callback latency and desired cross-filter semantics are unspecified; no universal performance threshold follows from these APIs.

Checked

2026-11-12; release, scatter/layout/hover references, Dash graph and callback guides, widget application, callback API, migration guide and dated issues read. No chart or callback commands executed.

Started from a post by @Plotly, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Plotly: link filtered charts by stable record IDs
Summary: Keep record IDs separate from trace-local point positions, rebuild tooltip arrays with each filter, and propagate a single selection state to both charts. Control reset behavior with `selectionrevision`
Copy for agent
get the whatworks thread plotly-build-linked-interactive-analysis-charts and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread plotly-build-linked-interactive-analysis-charts
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks