syncfusion / flutter-widgets

Syncfusion Flutter widgets libraries include high quality UI widgets and file-format packages to help you create rich, high-quality applications for iOS, Android, and web from a single code base.
1.57k stars 768 forks source link

SfCartesianChart panning bug when i set initialVisibleMaximum and initialVisibleMinimum #1864

Closed Li-Shuangzhi closed 3 months ago

Li-Shuangzhi commented 4 months ago

Bug description

My original requirement was to display 10 columns in the center of the initial positioning view. But when I set 'initialVisibleMaximum' and 'initialVisibleMinimum', there was a problem with the sliding, and when I slid, the table state changed directly to the end of the table state.

Steps to reproduce

using my code below

Code sample

Code sample ```dart import 'package:flutter/material.dart'; import 'package:syncfusion_flutter_charts/charts.dart'; class ChartPage extends StatefulWidget { const ChartPage({Key? key}) : super(key: key); @override _ChartPageState createState() => _ChartPageState(); } class _ChartPageState extends State { final List chartData = [ ChartData(1, 35), ChartData(2, 23), ChartData(3, 34), ChartData(4, 25), ChartData(5, 40), ChartData(6, 40), ChartData(7, 40), ChartData(8, 40), ChartData(9, 40), ChartData(10, 40), ChartData(11, 40), ChartData(12, 40), ChartData(13, 40), ChartData(14, 40), ChartData(15, 40), ChartData(16, 40), ChartData(17, 40), ChartData(18, 40), ChartData(19, 40), ChartData(20, 40), ChartData(21, 40), ChartData(22, 40), ChartData(23, 40), ChartData(24, 40), ChartData(25, 40), ChartData(26, 40), ChartData(27, 40), ChartData(28, 40), ChartData(29, 40), ChartData(30, 11), ]; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Chart Page'), ), body: Center( child: SfCartesianChart( primaryXAxis: NumericAxis( initialVisibleMaximum: 19.5, initialVisibleMinimum: 9.5, autoScrollingDelta: 10, ), zoomPanBehavior: ZoomPanBehavior( enablePinching: true, enablePanning: true, enableDoubleTapZooming: true, enableSelectionZooming: true, zoomMode: ZoomMode.x, ), series: >[ ColumnSeries( dataSource: chartData, xValueMapper: (ChartData data, _) => data.x, yValueMapper: (ChartData data, _) => data.y) ] ) ) ); } } class ChartData { ChartData(this.x, this.y); final int x; final double y; } ```

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

https://github.com/syncfusion/flutter-widgets/assets/60538671/6c694f71-a8b7-43d6-b636-23a144875711

pay attention to the digit on bottom

Stack Traces

Stack Traces ```dart ..... ```

On which target platforms have you observed this bug?

Android

Flutter Doctor output

Doctor output ```console [✓] Flutter (Channel stable, 3.19.6, on Microsoft Windows [Version 10.0.19044.4412], locale en-US) • Flutter version 3.19.6 on channel stable at D:\flutter\flutter_windows_3.19.6-stable\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 54e66469a9 (4 weeks ago), 2024-04-17 13:08:03 -0700 • Engine revision c4cd48e186 • Dart version 3.3.4 • DevTools version 2.31.1 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn [✓] Windows Version (Installed version of Windows is version 10 or higher) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\lsz\AppData\Local\Android\Sdk • Platform android-34, build-tools 30.0.3 • ANDROID_HOME = C:\Users\lsz\AppData\Local\Android\Sdk • ANDROID_SDK_ROOT = C:\Users\lsz\AppData\Local\Android\Sdk • Java binary at: D:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619) • All Android licenses accepted. [✓] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [✓] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.2.4) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional • Visual Studio Professional 2022 version 17.2.32602.215 • Windows 10 SDK version 10.0.19041.0 [✓] Android Studio (version 2022.1) • Android Studio at D:\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 • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619) [✓] IntelliJ IDEA Ultimate Edition (version 2021.3) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2021.3 • 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 [✓] VS Code (version 1.89.1) • VS Code at C:\Users\lsz\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.34.0 [✓] Connected device (4 available) • Mi 10 (mobile) • bfcdd5e3 • android-arm64 • Android 13 (API 33) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.4412] • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.207 • Edge (web) • edge • web-javascript • Microsoft Edge 124.0.2478.105 [✓] Network resources • All expected network resources are available. • No issues found! ```
ghost commented 4 months ago

Hi @Li-Shuangzhi,

We have replicated the issue you reported on our end. This issue is scheduled to be fixed in our upcoming weekly release on May 28, 2024. We will provide you with more information. Thank you for your understanding and patience in the meantime.

Regards, Lokesh P.

ghost commented 4 months ago

Hi @Li-Shuangzhi,

We would like to inform you ​that intialVisibleMinimum, initialVisibleMaximum and autoScrollingDelta features are used to view the particular dataPoints in the visible range. We have fixed the reported issue at our end, currently its under testing phase. We will include this fix in our upcoming weekly patch release on June 4, 2024. We appreciate your patience until then.

Root cause: First intialVisibleMinimum and initialVisibleMaximum was calculated and then autoScrolling range was calculated. So, zoomFactor and zoomPosition was updating based on the autoScrolling and did not update with actualRange.

Regards, Lokesh P.

ghost commented 4 months ago

Hi @Li-Shuangzhi,

Thank you for your patience. The reported issue is fixed and rolled out in our weekly patch release. To avoid this issue, we kindly request you to upgrade the syncfusion_flutter_charts package to the latest version below.

Version Link: https://pub.dev/packages/syncfusion_flutter_charts/versions/25.2.7

Root cause: First intialVisibleMinimum and initialVisibleMaximum was calculated and then autoScrolling range was calculated. So, zoomFactor and zoomPosition was updating based on the autoScrolling and did not update with actualRange.

Currently, we don't have support for auto scroll when set initialVisibleMinimum, initialVisibleMaximum and autoScrolling at the same time. We have logged a feature request for auto scroll should work when set initialVisibleMinimum, initialVisibleMaximum and autoScrolling in our feedback portal, and it is uncertain. This feature will be available in one of our upcoming releases. We will notify you when this feature is implemented. We appreciate your patience until then. If you have any additional specifications or suggestions for this feature request, please feel free to leave them in the comments section of the feedback link. This will help us understand how you would like to use it and how we can improve it.

FR Link: https://www.syncfusion.com/feedback/58291

Regards, Lokesh P.