[charts] Improve progressive scatter zoom#22817
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Deploy previewBundle size
PerformanceTotal duration: 1,757.18 ms -19.28 ms(-1.1%) | Renders: 67 (+0)
21 tests within noise — details Metric alarms
Check out the code infra dashboard for more information about this PR. |
|
@JCQuintas @alexfauquette Kindly have a review on this pr. Thanks! |
|
Hi @Anexus5919 thanks for the interest, while your solution goes straight to the point, this one required a bit more architectural changes to be stable. I was working on a PR for this issue before you opened this one, so it was easier to keep my work there rather than try to integrate it to your changes You can see the main behaviour difference in this comment #22862 (comment) I'll be closing this one to avoid confusion. |
Summary
Follow-up to #22518 (the progressive scatter renderer), requested in this review comment and tracked in #22731.
When the progressive renderer is active on a large scatter dataset, zooming or panning used to repaint every visible point on each interaction frame. The progressive batching only protected the first paint, not the interaction, so large datasets could stutter while the user zoomed or panned.
This PR makes the progressive scheduler zoom aware: while a zoom or pan interaction is in progress, only the first batch of each series is painted, which keeps every interaction frame cheap. Once the interaction settles, the remaining batches are revealed progressively, exactly like the initial paint.
How it works
selectorChartZoomIsInteracting. While it istrue,revealedRoundsis capped to the first batch (INTERACTION_REVEALED_ROUNDS = 1).falseagain, the existing animation frame ramp resumes from the current reveal count up to the full count.isInteractingdebounce, which is the same signal the line, bar, and area charts already use to skip animation during zoom. No new timer is introduced.useProgressiveRenderingnow declaresUseChartCartesianAxisSignatureas a dependency (it is always registered before progressive rendering in every chart), mirroringuseChartClosestPoint.Behavior
isInteractingstaysfalseand the renderer behaves exactly as before.Testing
Added
ScatterChartPro.progressive.test.tsx: it renders 1500 points withrenderer="svg-progressive", asserts all 1500 markers are revealed at rest, that the count drops to the first batch (1000) during a zoom interaction, and that it returns to 1500 after the interaction settles.Verified locally: TypeScript (
x-charts,x-charts-pro,x-charts-premium), ESLint, and the existing scatter test suites all pass.Closes #22731
Changelog
[charts]The progressive scatter renderer now stays fluid while zooming and panning: it paints only the first batch during the interaction and reveals the rest once it settles.