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

[syncfusion_flutter_charts][ios] _offsetFromRawPoints in base.dart throws in some cases #2240

Open
flocbit opened this issue Jan 2, 2025 · 1 comment
Labels
charts Charts component waiting for customer response Cannot make further progress until the customer responds.

Comments

@flocbit
Copy link

flocbit commented Jan 2, 2025

Bug description

I received a few stacktraces related to a syncfusion_flutter_charts (28.1.33) code section in base.dart line 2877:

type 'Null' is not a subtype of type 'num'. Error thrown .

Steps to reproduce

Can't reproduce it myself as it seems to be a corner case.

Code sample

Code sample
Offset _offsetFromRawPoints(CartesianChartAnnotation annotation) {
    final RenderChartAxis? xAxis = _xAxis(annotation);
    final RenderChartAxis? yAxis = _yAxis(annotation);
    if (xAxis != null && yAxis != null) {
      final Offset position = rawValueToPixelPoint(
          annotation.x, annotation.y, xAxis, yAxis, isTransposed); // This is the line where the error was thrown
      return Offset(
          position.dx + _plotAreaOffset.dx, position.dy + _plotAreaOffset.dy);
    }
    return Offset.zero;
  }

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Stack Traces

Stack Traces
[redacted]

Fatal Exception: FlutterError
0  App                            0x21706b RenderAnnotationArea._offsetFromRawPoints + 2877 (base.dart:2877)
1  App                            0x2167f7 RenderAnnotationArea.performLayout + 2843 (base.dart:2843)
2  App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
3  App                            0x2255df RenderCartesianChartArea.performLayout + 975 (base.dart:975)
4  App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
5  App                            0x22753b RenderLegendLayoutHandler.performLayout + 990 (core_legend.dart:990)
6  App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
7  App                            0x20b82b RenderPadding.performLayout + 234 (shifted_box.dart:234)
8  App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
9  App                            0x20b82b RenderPadding.performLayout + 234 (shifted_box.dart:234)
10 App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
11 App                            0x20d327 RenderProxyBoxMixin.performLayout + 111 (proxy_box.dart:111)
12 App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
13 App                            0x20d327 RenderProxyBoxMixin.performLayout + 111 (proxy_box.dart:111)
14 App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
15 App                            0x20dab3 RenderLayoutBuilder.performLayout + 371 (layout_builder.dart:371)
16 App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
17 App                            0x1c3aa7 ChildLayoutHelper.layoutChild (#2) + 61 (layout_helper.dart:61)
18 App                            0x1c3a43 ChildLayoutHelper.layoutChild + 60 (layout_helper.dart:60)
19 App                            0x19e367 RenderFlex._computeSizes + 1009 (flex.dart:1009)
20 App                            0x2153ff RenderFlex.performLayout + 1051 (flex.dart:1051)
21 App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
22 App                            0x1c3aa7 ChildLayoutHelper.layoutChild (#2) + 61 (layout_helper.dart:61)
23 App                            0x1c3a43 ChildLayoutHelper.layoutChild + 60 (layout_helper.dart:60)
24 App                            0x19e367 RenderFlex._computeSizes + 1009 (flex.dart:1009)
25 App                            0x2153ff RenderFlex.performLayout + 1051 (flex.dart:1051)
26 App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
27 App                            0x1c3aa7 ChildLayoutHelper.layoutChild (#2) + 61 (layout_helper.dart:61)
28 App                            0x1c3a43 ChildLayoutHelper.layoutChild + 60 (layout_helper.dart:60)
29 App                            0x1c5e9f RenderStack._computeSize + 595 (stack.dart:595)
30 App                            0x21750f RenderStack.performLayout + 622 (stack.dart:622)
31 App                            0x8778cb RenderObject.layout + 2608 (object.dart:2608)
32 App                            0x1c3aa7 ChildLayoutHelper.layoutChild (#2) + 61 (layout_helper.dart:61)
33 App                            0x1c3a43 ChildLayoutHelper.layoutChild + 60 (layout_helper.dart:60)
34 App                            0x19e367 RenderFlex._computeSizes + 1009 (flex.dart:1009)
35 App                            0x2153ff RenderFlex.performLayout + 1051 (flex.dart:1051)
36 App                            0x8d2b63 RenderObject._layoutWithoutResize + 2446 (object.dart:2446)
37 App                            0x8d2a23 PipelineOwner.flushLayout + 1052 (object.dart:1052)
38 App                            0x8d2abf PipelineOwner.flushLayout + 1065 (object.dart:1065)
39 App                            0x41cc17 RendererBinding.drawFrame + 602 (binding.dart:602)
40 App                            0x41c877 WidgetsBinding.drawFrame + 1164 (binding.dart:1164)
41 App                            0x41c1af RendererBinding._handlePersistentFrameCallback (#2) + 468 (binding.dart:468)
42 App                            0x41c173 RendererBinding._handlePersistentFrameCallback + 467 (binding.dart:467)
43 App                            0x846583 SchedulerBinding._invokeFrameCallback + 1397 (binding.dart:1397)
44 App                            0x846327 SchedulerBinding.handleDrawFrame + 1318 (binding.dart:1318)
45 App                            0x5b5eb SchedulerBinding._handleDrawFrame (#2) + 1176 (binding.dart:1176)
46 App                            0x5b4c3 SchedulerBinding._handleDrawFrame + 1158 (binding.dart:1158)
47 App                            0x49e7b invoke + 312 (hooks.dart:312)
48 App                            0x4bbcf PlatformDispatcher._drawFrame + 419 (platform_dispatcher.dart:419)
49 App                            0x4bb93 drawFrame + 283 (hooks.dart:283)
50 App                            0x4bbff drawFrame (#2) + 281 (hooks.dart:281)

[redacted]

On which target platforms have you observed this bug?

iOS

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.24.5, on macOS 15.1.1 24B91 darwin-arm64, locale en-DE)
    • Flutter version 3.24.5 on channel stable at /Users/xx/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision dec2ee5c1f (7 weeks ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/xx/Library/Android/sdk
    • Platform android-34, build-tools 35.0.0
    • ANDROID_HOME = /Users/xx/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

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

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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.10+0-17.0.10b1087.21-11609105)

[✓] VS Code (version 1.96.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

[✓] Connected device (5 available)
    • ...

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

• No issues found!
@Yuvaraj-Gajaraj
Copy link
Contributor

Hi @flocbit ,

We have tried to reproduce the reported issue using the shared stack trace and details. We would like to inform you that the _offsetFromRawPoints method is used to calculate the pixel value for placing an annotation on the chart. This method requires valid x and y values to function correctly. However, in this case, a null value was passed for either the x or y parameter, which is causing the issue.

To resolve this, please ensure that no null values are assigned to the x or y properties of any annotation.

Thanks,
Yuvaraj.

@LavanyaGowtham2021 LavanyaGowtham2021 added charts Charts component open Open waiting for customer response Cannot make further progress until the customer responds. and removed open Open labels Jan 6, 2025
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

3 participants