Skip to content
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

Multiple RangeErrors from yaxis when rendering SFCartesianChart #2212

Open
redwildrider opened this issue Dec 17, 2024 · 2 comments
Open

Multiple RangeErrors from yaxis when rendering SFCartesianChart #2212

redwildrider opened this issue Dec 17, 2024 · 2 comments
Labels
charts Charts component waiting for customer response Cannot make further progress until the customer responds.

Comments

@redwildrider
Copy link

redwildrider commented Dec 17, 2024

Bug description

This bug clogs up my sentry and I cannot avoid it or filter it out

Steps to reproduce

  1. Render linechart

Code sample

Code sample
ChartAxis yAxis(TrainingState state, WeightUnit weightUnit) {
    return NumericAxis(
      axisLabelFormatter: (AxisLabelRenderDetails details) => _yAxisLabelFormatter(details, weightUnit),
      maximumLabels: 3,
      borderColor: Colors.transparent,
      borderWidth: 0,
      tickPosition: TickPosition.inside,
      labelStyle: Theme.of(context).textTheme.bodyLarge!.copyWith(fontSize: 12),
      majorTickLines: const MajorTickLines(color: Colors.transparent),
      majorGridLines: MajorGridLines(color: Theme.of(context).colorScheme.surface, width: 1.5),
      opposedPosition: false,
      axisLine: const AxisLine(color: Colors.transparent),
      edgeLabelPlacement: _getEdgeLabelPlacement(),
      labelAlignment: LabelAlignment.end,
      labelPosition: ChartDataLabelPosition.inside,
    );
  }

Screenshots or Video

Screenshots / Video demonstration

Bildschirmfoto 2024-12-17 um 10 48 02

Stack Traces

Stack Traces
════════ Exception caught by rendering library ═════════════════════════════════
The following RangeError was thrown during performLayout():
RangeError (length): Invalid value: Not in inclusive range 0..1: 2

The relevant error-causing widget was:
    NumericAxis NumericAxis:file:///Users/steffenkarcher/Projects/flutter-app/nutrilize/lib/view/screens/training/evaluation/training_diagram.dart:107:12

When the exception was thrown, this was the stack:
#0      List.[] (dart:core-patch/growable_array.dart)
#1      RenderChartAxis._arrangeLabels (package:syncfusion_flutter_charts/src/charts/axis/axis.dart:2623:29)
axis.dart:2623
#2      RenderChartAxis._calculateLabelPositions (package:syncfusion_flutter_charts/src/charts/axis/axis.dart:2516:9)
axis.dart:2516
#3      RenderChartAxis.generateVisibleLabels (package:syncfusion_flutter_charts/src/charts/axis/axis.dart:2439:5)
axis.dart:2439
#4      RenderNumericAxis.generateVisibleLabels (package:syncfusion_flutter_charts/src/charts/axis/numeric_axis.dart:634:11)
numeric_axis.dart:634
#5      RenderChartAxis.performLayout (package:syncfusion_flutter_charts/src/charts/axis/axis.dart:1952:7)
axis.dart:1952
#6      RenderObject.layout (package:flutter/src/rendering/object.dart:2608:7)
object.dart:2608
#7      RenderCartesianAxes.performLayout.measureVerticalAxes (package:syncfusion_flutter_charts/src/charts/base.dart:2154:14)
base.dart:2154
#8      RenderCartesianAxes.performLayout (package:syncfusion_flutter_charts/src/charts/base.dart:2170:5)
base.dart:2170
#9      RenderObject.layout (package:flutter/src/rendering/object.dart:2608:7)
object.dart:2608
#10     RenderCartesianChartArea.performLayout (package:syncfusion_flutter_charts/src/charts/base.dart:944:23)
base.dart:944
#11     RenderObject.layout (package:flutter/src/rendering/object.dart:2608:7)
object.dart:2608
#12     _RenderLegendLayoutHandler.performLayout (package:syncfusion_flutter_charts/src/charts/common/core_legend.dart:990:15)
core_legend.dart:990
#13     RenderObject.layout (package:flutter/src/rendering/object.dart:2608:7)
object.dart:2608
#14     RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:234:12)
shifted_box.dart:234
#15     RenderObject.layout (package:flutter/src/rendering/object.dart:2608:7)
object.dart:2608
#16     RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:234:12)
shifted_box.dart:234
#17     RenderObject.layout (package:flutter/src/rendering/object.dart:2608:7)
object.dart:2608
#18     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:21)
proxy_box.dart:111
#19     RenderObject.layout (package:flutter/src/rendering/object.dart:2608:7)
object.dart:2608
#20     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:21)
proxy_box.dart:111
#21     RenderObject.layout (package:flutter/src/rendering/object.dart:2608:7)
object.dart:2608
#22     ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:61:11)
layout_helper.dart:61
#23     RenderFlex._computeSizes (package:flutter/src/rendering/flex.dart:985:73)
flex.dart:985
#24     RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:1051:32)
flex.dart:1051
#25     RenderObject.layout (package:flutter/src/rendering/object.dart:2608:7)
object.dart:2608

On which target platforms have you observed this bug?

Android, iOS

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.1.1 24B91 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.96.0)
[✓] Connected device (6 available)
[✓] Network resources

• No issues found!
@VijayakumarMariappan VijayakumarMariappan added charts Charts component open Open labels Dec 18, 2024
@Baranibharathip
Copy link

Hi redwildrider,

We have checked the reported issue, 'facing a range exception on the Y-axis in Cartesian Charts,' and tried to replicate it in the latest 28.1.35 version of SfCartesianChart by,

  1. Ensured with different maximumLabels value.
  2. Ensured with edgeLabelPlacement.
  3. Ensured with minimizing the window size.

However, we were unable to reproduce it on our end. Please check the attached sample, and if you are still experiencing the issue, we kindly request you to share us with more information on your requirement in detail along with screenshots/screen recordings so that it will help us assist you in a better way.

Sample : GH_2212.zip

Regards,
Baranibharathi P.

@LavanyaGowtham2021 LavanyaGowtham2021 added waiting for customer response Cannot make further progress until the customer responds. and removed open Open labels Dec 20, 2024
@redwildrider
Copy link
Author

Hi Baranibharathi,
thank you so much for your quick reply!

I figured out that the issue only happens when edgeLabelPlacement is so to "hide" for the y-Axis.
MaximumLabels seems to be irrelevant.

The data i am displaying which produces the error: (x - y)

flutter: 2024-11-05 19:12:00.000 - 0.0
flutter: 2024-11-14 00:00:00.000 - 0.0
flutter: 2024-11-15 00:00:00.000 - 0.0
flutter: 2024-11-25 00:00:00.000 - 10.0
flutter: 2024-12-12 00:00:00.000 - 5.0
flutter: 2024-12-13 00:00:00.000 - 0.0
flutter: 2024-12-26 04:48:00.000 - 0.0

If there are only datapoints with y = 0, the error does not happen.
I do not see the error visually, its only the error message in the console.
I am testing on IPhone 16 Simulator right now.

Let me know if I can provide you with some more specific information.

Regards
Steffen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
charts Charts component waiting for customer response Cannot make further progress until the customer responds.
Projects
None yet
Development

No branches or pull requests

4 participants