Skip to content

Close #1449: regression-test ChartComponent axis-locked panning#5115

Merged
shai-almog merged 1 commit into
masterfrom
fix-1449-chart-axis-locked-panning
May 30, 2026
Merged

Close #1449: regression-test ChartComponent axis-locked panning#5115
shai-almog merged 1 commit into
masterfrom
fix-1449-chart-axis-locked-panning

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

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") via XYMultipleSeriesRenderer.setPanEnabled(boolean, boolean) and the matching ChartComponent.setPanEnabled(boolean, boolean) wrapper, but no end-to-end drag test covered the lock-axis behaviour and the issue was never closed.

Changes

  1. Three regression tests in ChartComponentTest that drive ChartComponent.pointerDragged through a 100×100 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 Y stays pinned to [0, 10].
    • dragWithOnlyYPanEnabledLeavesXRangeUnchanged — the mirror case.
    • dragWithBothAxesPanEnabledMovesBoth — sanity check that the default still pans both axes.
  2. Doc-comment expansion on 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

  • All three new tests pass locally on the JDK 8 build.
  • The original gap was real: a first cut of the helper that called component.setPanEnabled(true) first clobbered the per-axis flags (because XYMultipleSeriesRenderer.setPanEnabled(boolean) calls setPanEnabled(enabled, enabled) per its own javadoc). Tests caught that immediately with expected: <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.
  • Full chart sweep — 40 tests across BarChartTest, PieChartTest, DoughnutChartTest, ChartComponentTest, the RadarChartSampleTest regression and other *Chart* suites — all green.
  • No Unicode characters in the touched sources (per the project's ASCII-only rule).
  • CI verification.

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

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>
@github-actions
Copy link
Copy Markdown
Contributor

Cloudflare Preview

@github-actions
Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 122 screenshots: 122 matched.

Native Android coverage

  • 📊 Line coverage: 12.81% (7458/58229 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.42% (37352/358503), branch 4.32% (1464/33874), complexity 5.42% (1764/32544), method 9.46% (1442/15249), class 15.52% (330/2126)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 12.81% (7458/58229 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.42% (37352/358503), branch 4.32% (1464/33874), complexity 5.42% (1764/32544), method 9.46% (1442/15249), class 15.52% (330/2126)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1162.000 ms
Base64 CN1 encode 244.000 ms
Base64 encode ratio (CN1/native) 0.210x (79.0% faster)
Base64 native decode 1211.000 ms
Base64 CN1 decode 180.000 ms
Base64 decode ratio (CN1/native) 0.149x (85.1% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog shai-almog merged commit f25c66f into master May 30, 2026
22 checks passed
@shai-almog shai-almog deleted the fix-1449-chart-axis-locked-panning branch May 30, 2026 13:46
@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 121 screenshots: 121 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 235 seconds

Build and Run Timing

Metric Duration
Simulator Boot 78000 ms
Simulator Boot (Run) 1000 ms
App Install 12000 ms
App Launch 6000 ms
Test Execution 372000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 977.000 ms
Base64 CN1 encode 2200.000 ms
Base64 encode ratio (CN1/native) 2.252x (125.2% slower)
Base64 native decode 625.000 ms
Base64 CN1 decode 1430.000 ms
Base64 decode ratio (CN1/native) 2.288x (128.8% slower)
Base64 SIMD encode 602.000 ms
Base64 encode ratio (SIMD/native) 0.616x (38.4% faster)
Base64 encode ratio (SIMD/CN1) 0.274x (72.6% faster)
Base64 SIMD decode 633.000 ms
Base64 decode ratio (SIMD/native) 1.013x (1.3% slower)
Base64 decode ratio (SIMD/CN1) 0.443x (55.7% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 109.000 ms
Image createMask (SIMD on) 13.000 ms
Image createMask ratio (SIMD on/off) 0.119x (88.1% faster)
Image applyMask (SIMD off) 255.000 ms
Image applyMask (SIMD on) 73.000 ms
Image applyMask ratio (SIMD on/off) 0.286x (71.4% faster)
Image modifyAlpha (SIMD off) 133.000 ms
Image modifyAlpha (SIMD on) 59.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.444x (55.6% faster)
Image modifyAlpha removeColor (SIMD off) 153.000 ms
Image modifyAlpha removeColor (SIMD on) 111.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.725x (27.5% faster)
Image PNG encode (SIMD off) 1389.000 ms
Image PNG encode (SIMD on) 1075.000 ms
Image PNG encode ratio (SIMD on/off) 0.774x (22.6% faster)
Image JPEG encode 702.000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 30, 2026

Compared 122 screenshots: 122 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 265 seconds

Build and Run Timing

Metric Duration
Simulator Boot 73000 ms
Simulator Boot (Run) 0 ms
App Install 15000 ms
App Launch 16000 ms
Test Execution 311000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 576.000 ms
Base64 CN1 encode 1343.000 ms
Base64 encode ratio (CN1/native) 2.332x (133.2% slower)
Base64 native decode 292.000 ms
Base64 CN1 decode 1100.000 ms
Base64 decode ratio (CN1/native) 3.767x (276.7% slower)
Base64 SIMD encode 418.000 ms
Base64 encode ratio (SIMD/native) 0.726x (27.4% faster)
Base64 encode ratio (SIMD/CN1) 0.311x (68.9% faster)
Base64 SIMD decode 411.000 ms
Base64 decode ratio (SIMD/native) 1.408x (40.8% slower)
Base64 decode ratio (SIMD/CN1) 0.374x (62.6% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 83.000 ms
Image createMask (SIMD on) 14.000 ms
Image createMask ratio (SIMD on/off) 0.169x (83.1% faster)
Image applyMask (SIMD off) 170.000 ms
Image applyMask (SIMD on) 64.000 ms
Image applyMask ratio (SIMD on/off) 0.376x (62.4% faster)
Image modifyAlpha (SIMD off) 150.000 ms
Image modifyAlpha (SIMD on) 79.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.527x (47.3% faster)
Image modifyAlpha removeColor (SIMD off) 189.000 ms
Image modifyAlpha removeColor (SIMD on) 242.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 1.280x (28.0% slower)
Image PNG encode (SIMD off) 1891.000 ms
Image PNG encode (SIMD on) 1169.000 ms
Image PNG encode ratio (SIMD on/off) 0.618x (38.2% faster)
Image JPEG encode 691.000 ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

charts panning issue

1 participant