Skip to content

App crashes using showNormalDistributionCurve with insufficient data #2334

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
simprecicchiani opened this issue Apr 16, 2025 · 2 comments
Open
Labels
charts Charts component solved Solved the query using existing solutions

Comments

@simprecicchiani
Copy link

simprecicchiani commented Apr 16, 2025

Bug description

Plotting an HistogramSeries in SfCartesianChart with dataSource with 1 data point and showNormalDistributionCurve set to true seems to crash the entire app (tested on Chrome and iOS Simulator) and I can't see any stack trace from vscode debugger.

Steps to reproduce

plot an histogram series with 1 data point and set showNormalDistributionCurve: true

Code sample

Code sample
  @override
  Widget build(BuildContext context) {
    return SfCartesianChart(
      series: [
        HistogramSeries(
          dataSource: [1],
          yValueMapper: (e, i) => e,
          showNormalDistributionCurve: true,
        ),
      ],
    );
  }

Stack Traces

Stack Traces
Exhausted heap space, trying to allocate 1760 bytes.
[ERROR:flutter/shell/common/shell.cc(115)] Dart Error: Out of memory
Application finished.

On which target platforms have you observed this bug?

iOS

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.29.2, on macOS 15.3.2 24D81 darwin-arm64, locale en-US) [903ms]
    • Flutter version 3.29.2 on channel stable at /opt/homebrew/Caskroom/flutter/3.16.5/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c236373904 (5 weeks ago), 2025-03-13 16:17:06 -0400
    • Engine revision 18b71d647a
    • Dart version 3.7.2
    • DevTools version 2.42.3

[✗] Android toolchain - develop for Android devices [829ms]
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/to/macos-android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Xcode - develop for iOS and macOS (Xcode 16.3) [1,689ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16E140
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [10ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed) [9ms]
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/macos-android-setup for detailed instructions).

[✓] VS Code (version 1.99.2) [9ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.108.0

[✓] Connected device (6 available) [5.9s]
    • iPhone 16 (mobile)                           • 044837D9-0C49-4690-BF96-E6C91A231E01 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-18-4 (simulator)
    • macOS (desktop)                              • macos                                • darwin-arm64   • macOS 15.3.2 24D81
      darwin-arm64
    • Mac Designed for iPad (desktop)              • mac-designed-for-ipad                • darwin         • macOS 15.3.2 24D81
      darwin-arm64
    • Chrome (web)                                 • chrome                               • web-javascript • Google Chrome
      135.0.7049.85

[✓] Network resources [700ms]
    • All expected network resources are available.

! Doctor found issues in 2 categories.
@VijayakumarMariappan VijayakumarMariappan added charts Charts component open Open labels Apr 21, 2025
@ManiKesavaraj
Copy link
Contributor

Hi Simprecicchiani,

We have reproduced the issue you reported on our end and the issue is scheduled to be fixed in our upcoming weekly patch release on Apr 29, 2025. We will notify you here once the release has been rolled out, and we appreciate your patience in the meantime. 

Root cause: Calculated deviation becomes NaN due to division by zero (from data length 1), which causes an infinite loop and leads to an out-of-memory crash. 

Regards,
Naveen K.

@VijayakumarMariappan VijayakumarMariappan added bug Something isn't working follow-up scheduled Follow-up scheduled and removed open Open labels Apr 22, 2025
@Mugunthan-Ramalingam
Copy link
Contributor

Hi @simprecicchiani,

The reported issue has been fixed and rolled out in our weekly patch release on April 29, 2025. So, we kindly request you to upgrade the syncfusion_flutter_charts package to the latest version below.

Version: https://pub.dev/packages/syncfusion_flutter_charts/versions/29.1.40

Root cause: Calculated deviation becomes NaN due to division by zero (from data length 1), which causes an infinite loop and leads to an out-of-memory crash.

Demo:

Image

Note: In a HistogramSeries, when only a single data point is provided, the segment will occupy the full chart area by default. This is consistent with other Side-by-Side (SBS) type series. To adjust the segment width, you can use the width property of the HistogramSeries. Please refer to the following demo for reference.

Demo:

Image

Regards,
Mugunthan.

@LavanyaGowtham2021 LavanyaGowtham2021 added solved Solved the query using existing solutions and removed bug Something isn't working follow-up scheduled Follow-up scheduled labels Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
charts Charts component solved Solved the query using existing solutions
Projects
None yet
Development

No branches or pull requests

5 participants