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 771 forks source link

Stress Test on Chart and CanvasKit #193

Closed codeeuser closed 3 years ago

codeeuser commented 3 years ago

I encountered issue on the Chart and the canvasKit issue with the following error message after stress test with keep refresh the data. I tested on Flutter Web only. syncfusion_flutter_charts: ^19.1.56 May I get a guide to solve this?

flutter doctor -v [√] Flutter (Channel stable, 2.0.4, on Microsoft Windows [Version 10.0.19042.928], locale en-MY) • Flutter version 2.0.4 at C:\development\flutter • Framework revision b1395592de (13 days ago), 2021-04-01 14:25:01 -0700 • Engine revision 2dce47073a • Dart version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\USER\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0) • 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 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.55.2) • VS Code at C:\Users\USER\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.21.0

[√] Connected device (2 available) • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.128 • Edge (web) • edge • web-javascript • Microsoft Edge 85.0.564.67

• No issues found!

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════ The following NativeJavaScriptObject object was thrown during paint(): RuntimeError: abort(undefined). Build with -s ASSERTIONS=1 for more info.

The relevant error-causing widget was: SfCartesianChart file:///Users/wheref/AndroidStudioProjects/dragboard/lib/widgets/chart_line_widget.dart:57:22

When the exception was thrown, this was the stack: https://unpkg.com/canvaskit-wasm@0.24.0/bin/canvaskit.js 150:56 Ma https://unpkg.com/canvaskit-wasm@0.24.0/bin/canvaskit.js 220:103 d https://unpkg.com/canvaskit-wasm@0.24.0/bin/canvaskit.js 1:1 ParagraphBuilder$build lib/_engine/engine/canvaskit/text.dart 850:50 [_buildCkParagraph] lib/_engine/engine/canvaskit/text.dart 844:28 build packages/flutter/src/painting/text_painter.dart 571:27 layout packages/syncfusion_flutter_charts/src/chart/utils/helper.dart 23:5 _drawText packages/syncfusion_flutter_charts/src/chart/axis/axis.dart 2010:11 drawVerticalAxesLabels packages/syncfusion_flutter_charts/src/chart/axis/axis_renderer.dart 383:19 [_drawVerticalAxes] packages/syncfusion_flutter_charts/src/chart/axis/axis_renderer.dart 423:13 [_drawAxes] packages/syncfusion_flutter_charts/src/chart/axis/axis_renderer.dart 318:5 [_onAxisDraw] packages/syncfusion_flutter_charts/src/chart/axis/axis_renderer.dart 302:5 paint packages/flutter/src/rendering/custom_paint.dart 564:12 [_paintWithPainter] packages/flutter/src/rendering/custom_paint.dart 605:7 paint packages/flutter/src/rendering/object.dart 2322:7 [_paintWithContext] packages/flutter/src/rendering/object.dart 189:12 paintChild packages/flutter/src/rendering/proxy_box.dart 142:14 paint packages/flutter/src/rendering/object.dart 2322:7 [_paintWithContext] packages/flutter/src/rendering/object.dart 140:10 _repaintCompositedChild packages/flutter/src/rendering/object.dart 100:5 repaintCompositedChild packages/flutter/src/rendering/object.dart 978:29 flushPaint packages/flutter/src/rendering/binding.dart 455:19 drawFrame packages/flutter/src/widgets/binding.dart 874:13 drawFrame packages/flutter/src/rendering/binding.dart 319:5 [_handlePersistentFrameCallback] packages/flutter/src/scheduler/binding.dart 1144:15 [_invokeFrameCallback] packages/flutter/src/scheduler/binding.dart 1082:9 handleDrawFrame packages/flutter/src/scheduler/binding.dart 998:5 [_handleDrawFrame] lib/_engine/engine/platform_dispatcher.dart 896:13 invoke lib/_engine/engine/platform_dispatcher.dart 145:5 invokeOnDrawFrame lib/_engine/engine.dart 259:45 dart-sdk/lib/async/zone.dart 1370:13 _rootRunUnary dart-sdk/lib/async/zone.dart 1265:19 runUnary dart-sdk/lib/async/zone.dart 1170:7 runUnaryGuarded dart-sdk/lib/async/zone.dart 1207:26

The following RenderObject was being processed when the exception was fired: RenderCustomPaint#a7a7b relayoutBoundary=up2: creator: CustomPaint ← RepaintBoundary ← Container ← _CartesianAxisRenderer ← Stack ← Container ← DecoratedBox ← Container ← DecoratedBox ← ConstrainedBox ← Container ← Listener ← ⋯ parentData: (can use size) constraints: BoxConstraints(0.0<=w<=240.0, 0.0<=h<=280.0) size: Size(0.0, 0.0) This RenderObject has no descendants.

Dharanipalani commented 3 years ago

Hi @codeeuser,

Thanks for the interest in our Flutter charts. We have analyzed your query and we run the sample by refreshing the data of the chart continuously on the button click in the canvasKit but unfortunately, we not able to replicate the reported issue at our end. So, sharing more information like the chart type you are using and the data source like this will help you to analyze and provide the solution to you sooner. You can also revert us with the issue in the attached sample.

Sample: I324015_stress_test.zip

Thanks, Dharanitharan. P

codeeuser commented 3 years ago

hello, I have modified the code here for the stress test. I run "flutter run -d chrome --release" with error after few minutes. However, cmd "flutter run -d chrome" without error. Capture

Timer.periodic(Duration(microseconds: 100), (timer) { setState(() { chartData.clear(); }); });

Dharanipalani commented 3 years ago

Hi @codeeuser,

We have analyzed this and able to replicate this due to calling the setState, in which the whole data points are processed and redrawing the whole chart which leads to the above issue, and we are suggesting you use our public method updateDataSource. In this we processed only the newly added points instead of processing the whole calculation and redrawing all data points. We have checked this with the release mode and it is working properly without any issue.

To know more about you can refer to the help document

Thanks, Dharanitharan. P