Close #1449: regression-test ChartComponent axis-locked panning#5115
Merged
Conversation
The 2015 reporter asked for a way to "freeze the y axis panning and only allow panning left to right" on a chart, because vertical pans were destabilising their layout. The capability was added in 2017 (99d1382 "Improved panning and zooming in ChartComponent when using an XYChart or subclasses") via XYMultipleSeriesRenderer.setPanEnabled( boolean, boolean) and the matching ChartComponent.setPanEnabled( boolean, boolean) wrapper, but no regression test covered the end-to-end drag pipeline and the issue was never closed. Add three regression tests that drive ChartComponent.pointerDragged through a real 100x100 chart with a zero-padding/margin renderer and an initial [0,10] range on both axes: - dragWithOnlyXPanEnabledLeavesYRangeUnchanged: with setPanEnabled(true, false), a 30-pixel diagonal drag moves the X range while the Y range stays pinned to [0,10]. - dragWithOnlyYPanEnabledLeavesXRangeUnchanged: the mirror case. - dragWithBothAxesPanEnabledMovesBoth: sanity check that the default behaviour still pans both axes. Also expand the doc comment on ChartComponent.setPanEnabled(boolean, boolean) to call out the axis-locked use case, which is the cleanest documentation hook for users hitting the same wish today. Closes #1449. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Cloudflare Preview
|
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
|
Compared 122 screenshots: 122 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
Collaborator
Author
|
Compared 121 screenshots: 121 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
Collaborator
Author
|
Compared 122 screenshots: 122 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
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.
Summary
Closes #1449, the next-oldest open issue (filed April 2015).
The 2015 reporter asked for a way to "freeze the y axis panning and only allow panning left to right" because vertical pans were disrupting their chart layout. That capability shipped two years later in commit
99d13827b(April 2017, "Improved panning and zooming in ChartComponent when using an XYChart or subclasses") viaXYMultipleSeriesRenderer.setPanEnabled(boolean, boolean)and the matchingChartComponent.setPanEnabled(boolean, boolean)wrapper, but no end-to-end drag test covered the lock-axis behaviour and the issue was never closed.Changes
ChartComponentTestthat driveChartComponent.pointerDraggedthrough a 100×100 chart with a zero-padding/margin renderer and an initial[0, 10]range on both axes:dragWithOnlyXPanEnabledLeavesYRangeUnchanged— withsetPanEnabled(true, false), a 30-pixel diagonal drag moves the X range while Y stays pinned to[0, 10].dragWithOnlyYPanEnabledLeavesXRangeUnchanged— the mirror case.dragWithBothAxesPanEnabledMovesBoth— sanity check that the default still pans both axes.setPanEnabled(boolean, boolean)to call out the axis-locked use case with a concrete example. This is the discoverability hook the 2015 reporter (and anyone hitting the same wish today) needs.Test plan
component.setPanEnabled(true)first clobbered the per-axis flags (becauseXYMultipleSeriesRenderer.setPanEnabled(boolean)callssetPanEnabled(enabled, enabled)per its own javadoc). Tests caught that immediately withexpected: <0.0> but was: <-3.0>. After ordering the helper so the per-axis call wins, all three are green — which also proves that as long as the per-axis API is used last, the 2017 fix really does keep the locked axis pinned.BarChartTest,PieChartTest,DoughnutChartTest,ChartComponentTest, theRadarChartSampleTestregression and other*Chart*suites — all green.What this does not change
The 2015 report also mentioned that "the screen has some problems repainting" during vertical pans. That part is too vague to act on without a concrete reproducer and is also moot for users who lock the Y axis. If anyone still hits a chart-repaint problem after locking the axis, a fresh focused issue with a repro is the right next step.
🤖 Generated with Claude Code