Skip to content

[syncfusion_flutter_charts] Zooming out not working as intended #2354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DrNiels opened this issue May 19, 2025 · 0 comments
Open

[syncfusion_flutter_charts] Zooming out not working as intended #2354

DrNiels opened this issue May 19, 2025 · 0 comments

Comments

@DrNiels
Copy link

DrNiels commented May 19, 2025

Bug description

I use a rangecontroller to define and update the current visible range of a chart. Zooming out slightly while keeping the same start and only updating the end seems to ignore the start and uses the chart's minimum value instead. I'm using syncfusion_flutter_charts in version 29.2.4.

Steps to reproduce

  1. Load the code sample
  2. Click the arrow icon
  3. According to the code, the new range should still start at 17th February 2025, but it's the year 2000 now

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
import 'package:syncfusion_flutter_core/core.dart';

void main() async {
  runApp(
    MaterialApp(
      home: TestChart(),
    ),
  );
}

class TestChart extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => TestChartState();
}

class TestChartState extends State<TestChart> {
  late RangeController rangeController;

  @override
  void initState() {
    super.initState();

    rangeController = RangeController(
      start: DateTime(2025, 2, 17),
      end: DateTime(2025, 2, 18),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        SfCartesianChart(
          primaryYAxis: NumericAxis(),
          primaryXAxis: DateTimeAxis(
            minimum: DateTime(2000),
            maximum: DateTime(
              2031,
            ),
            initialVisibleMinimum: this.rangeController.start,
            initialVisibleMaximum: this.rangeController.end,
            rangeController: this.rangeController,
          ),
        ),
        IconButton(
            icon: Icon(Icons.arrow_upward),
            onPressed: () {
              this.rangeController.start = DateTime(2025, 2, 17);
              this.rangeController.end = DateTime(2025, 2, 24);
              setState(() {});
            }),
      ],
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

Before zooming out via arrow button
Image

After zooming out
Image

Stack Traces

Stack Traces

No stack trace as there's no thrown error.

On which target platforms have you observed this bug?

Web

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.29.3, on Microsoft Windows [Version 10.0.19045.5854], locale de-DE) [567ms]
    • Flutter version 3.29.3 on channel stable at C:\Users\Niels\Documents\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ea121f8859 (5 weeks ago), 2025-04-11 19:10:07 +0000
    • Engine revision cf56914b32
    • Dart version 3.7.2
    • DevTools version 2.42.3

[√] Windows Version (10 Education 64-bit, 22H2, 2009) [2,1s]

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc4) [3,2s]
    • Android SDK at C:\Users\Niels\AppData\Local\Android\Sdk
    • Platform android-34, build-tools 34.0.0-rc4
    • Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web [162ms]
    • Chrome at C:\Users\Niels\AppData\Local\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.6) [161ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.8.34525.116
    • Windows 10 SDK version 10.0.19041.0

[!] Android Studio (version 2021.2) [27ms]
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    X Unable to determine bundled Java version.
    • Try updating or re-installing Android Studio.

[√] Android Studio (version 2024.1) [25ms]
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)

[√] VS Code, 64-bit edition (version 1.96.0) [24ms]
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.110.0

[√] Connected device (3 available) [268ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.5854]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 136.0.7103.114
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 128.0.2739.42

[√] Network resources [762ms]
    • All expected network resources are available.

! Doctor found issues in 1 category.
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

No branches or pull requests

1 participant