Add zoom-responsive styling for direct scatter points#100
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
Alek99
left a comment
There was a problem hiding this comment.
Review findings:
- [P2]
js/src/50_chartview.js:2261: y-only zoom never activates responsive styling because a finite x zoom of 1 wins the nullish-coalescing chain. Combine the applicable axis zoom factors instead. - [P2]
js/src/50_chartview.js:2432: hover emphasis uses scalarg.size, not the point's encoded size. Large size-channel points therefore get a smaller hover overlay than the rendered point. - [P2]
js/src/50_chartview.js:2311:zoom_opacityis applied to the fill but explicit point strokes retain base opacity. Apply the zoom-adjusted opacity to the outline while preservingstroke_opacity.
…sive-size-and-opacity-for-scatter-points # Conflicts: # examples/demo-advance.ipynb # js/src/50_chartview.ts # python/xy/components.py # python/xy/marks.py # python/xy/static/index.js # python/xy/static/standalone.js
- y-only zoom now activates emphasis: use the deepest of the x/y axis zoom factors instead of the first finite one. - Hover overlay sizes from the point's encoded size on size-channel traces, falling back to the scalar size when no CPU copy exists. - Explicit point strokes follow the zoom opacity ramp, interpolating from their stroke_opacity base toward the shared zoom_opacity target.
Greptile SummaryThis PR adds zoom-responsive styling for direct scatter points. The main changes are:
Confidence Score: 5/5This looks safe to merge. The alternate-axis zoom calculation now follows each scatter trace's configured axes. Rendering, hover, and picking preserve those axis identifiers. No blocking issues were found in the changed code.
What T-Rex did
Important Files Changed
Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
A scatter bound to x2/y2 rendered against those axes but derived its zoom emphasis from the primary x/y view ranges. Resolve current and home spans through _axisRange (view0.ranges holds every axis's home range), so alternate-axis traces respond to their own zoom and ignore primary-axis zooms.
…sive-size-and-opacity-for-scatter-points # Conflicts: # python/xy/static/index.js # python/xy/static/standalone.js
Motivation
Description
zoom_size_factor,zoom_opacity, andzoom_emphasisparameters to the fluentFigure.scatterAPI and the Reflex-stylecomponents.scatterfactory and serialized them into tracestylewith sensible, fixed-style-compatible defaults._pointZoomStylewas implemented injs/src/50_chartview.jsto compute a logarithmic interpolation (from the initial view) for size and opacity, clamped at the configuredzoom_emphasis.sizeFactorand adjusted opacity are applied consistently across rendering paths including the full points shader, the simple points shader, hover emphasis, and the pick/detection path so rendering, hover, and picking stay aligned.python/xy/marks.pyandpython/xy/components.py, tests were added/updated to cover serialization and validation, and static JS bundles were rebuilt and committed.Testing
PYTHONPATH=python python -m pytest tests/test_scatter.py tests/test_components.py -q, all tests passed (156 passed).node js/build.mjsandmake js-check, which succeeded and reported fresh static bundles.PYTHONPATH=python ruff check python/xy/marks.py python/xy/components.py tests/test_scatter.pyandgit diff --check, both succeeded.Codex Task
Closes #88