Add pan/zoom interaction switches for static-viewport charts#103
Merged
Conversation
interaction_config() covered hover, click, selection, brush, crosshair, view-change events, and linked views, but there was no supported way to freeze a chart's viewport: dashboard summary charts could still be drag-panned or wheel-zoomed, leaving bars or axes out of view, and hiding the modebar did not disable the gestures. Add pan= and zoom= to interaction_config() and the chart-level kwargs. pan=False ignores plain-drag pan; zoom=False ignores wheel zoom, box-zoom, double-click reset, and hides the modebar zoom controls (double-click still clears selection). Both flags serialize only when explicitly set, so absent keys stay enabled and existing specs are unchanged. With zoom disabled the wheel handler returns before preventDefault so the page scrolls naturally over a static chart, and a chart with both flags disabled ignores inbound linked-view updates.
Merging this PR will not alter performance
Comparing Footnotes
|
Alek99
reviewed
Jul 20, 2026
Alek99
left a comment
Member
There was a problem hiding this comment.
Review findings:
- [P2]
js/src/50_chartview.js:914: charts with pan and zoom disabled still settouch-action:none, so a touchscreen swipe over a static chart cannot scroll the containing dashboard. Make touch-action depend on enabled gestures/drag mode. - [P3]
js/src/53_interaction.js:1205: pan-disabled charts still initializedragMode="pan"and show a grab cursor even though plain dragging does nothing. Initialize/sanitize the mode from the enabled interactions.
Alek99
added a commit
that referenced
this pull request
Jul 21, 2026
The move in this PR promoted docs/engineering/ to spec/ and CLAUDE.md declares that tree the source of truth. An audit of all 24 documents against the code found the tree had drifted at PR #96: five behavior PRs (#103, #105, #106, #108, #115) had landed with no spec update, and ~100 claims contradicted shipped code. Accuracy: correct claims that no longer match the implementation, including the Rust ABI version (v31 -> v36), the "zero-crate cdylib" claim (png is a real dependency), the pyramid ABI function names, the panic-shield status, the R2/VAO claim in the renderer doc, the WASM/Web-Worker architecture in dossier §3/§8 (superseded by §32's C-ABI cdylib), the count-only tier rule, the matplotlib shim overhead figures (the cited guardrail says +60% at 10k, not +9%), and the Plotly Scattergl 10M figure that appeared as two different numbers from the same run. Coverage: add spec/api/export.md, spec/api/interaction.md and spec/design/wire-protocol.md for three surfaces that had no coverage at all, plus the config.py threshold table, full JS and Rust module inventories, and the hexbin centers-only wire contract that three renderers must expand identically. Structure: group 15 top-level files into api/, design/, matplotlib/, benchmarks/ and process/, and rewrite spec/README.md as a real index (it previously listed only the two SVG assets, leaving 21 of 22 docs unreachable). All 150 consumer references repointed, including the CI --emit-md target and the compat-matrix generator. Guard: verify_sdist.py pinned only 5 top-level spec files, so the sdist could silently lose spec/design/ or spec/assets/ and still pass; it now asserts markdown under every subdirectory and both SVGs.
Alek99
added a commit
that referenced
this pull request
Jul 21, 2026
…roup the tree (#122) * Move engineering docs to root spec directory * Resync spec/ with the implementation and group the tree The move in this PR promoted docs/engineering/ to spec/ and CLAUDE.md declares that tree the source of truth. An audit of all 24 documents against the code found the tree had drifted at PR #96: five behavior PRs (#103, #105, #106, #108, #115) had landed with no spec update, and ~100 claims contradicted shipped code. Accuracy: correct claims that no longer match the implementation, including the Rust ABI version (v31 -> v36), the "zero-crate cdylib" claim (png is a real dependency), the pyramid ABI function names, the panic-shield status, the R2/VAO claim in the renderer doc, the WASM/Web-Worker architecture in dossier §3/§8 (superseded by §32's C-ABI cdylib), the count-only tier rule, the matplotlib shim overhead figures (the cited guardrail says +60% at 10k, not +9%), and the Plotly Scattergl 10M figure that appeared as two different numbers from the same run. Coverage: add spec/api/export.md, spec/api/interaction.md and spec/design/wire-protocol.md for three surfaces that had no coverage at all, plus the config.py threshold table, full JS and Rust module inventories, and the hexbin centers-only wire contract that three renderers must expand identically. Structure: group 15 top-level files into api/, design/, matplotlib/, benchmarks/ and process/, and rewrite spec/README.md as a real index (it previously listed only the two SVG assets, leaving 21 of 22 docs unreachable). All 150 consumer references repointed, including the CI --emit-md target and the compat-matrix generator. Guard: verify_sdist.py pinned only 5 top-level spec files, so the sdist could silently lose spec/design/ or spec/assets/ and still pass; it now asserts markdown under every subdirectory and both SVGs.
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.
Problem
XY charts are interactive by default, but
interaction_config()only configured hover, click, selection, brush, crosshair, view-change events, and linked views — there was no supported way to make a chart's viewport static. Dashboard charts intended as fixed summaries could still be drag-panned or wheel-zoomed, leaving bars or axes partially out of view. Hiding the modebar does not disable the gestures, and disabling pointer events on a framework wrapper is brittle because the chart's canvas owns the interaction handlers.API
pan=False— plain-drag pan gestures are ignored; the modebar Pan button is hidden. Shift-drag / box select stay governed byselect/brush.zoom=False— wheel zoom, box-zoom, and double-click reset are ignored; the modebar zoom controls (Zoom In/Out, Box Zoom, Reset View, percent label) are hidden. Double-click still clears selection.Behavior details
zoom=Falsethe wheel handler returns beforepreventDefault(), so the page scrolls naturally over a static chart embedded in a dashboard.link_group) updates; with only one disabled, linked updates still apply.ValueErrorvia the existing centralized interaction validation.python/xy/static/regenerated vianode js/build.mjs.Testing
pan/zoomserialization (True and False), chart-level kwargs, andValueErroron non-bool values (tests/test_components.py).ruff check,ruff format --checkclean;ty checkhas one pre-existing diagnostic unrelated to this change (present on a clean tree).Closes #80