-
Notifications
You must be signed in to change notification settings - Fork 782
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] Axis with very small range causes crash #2138
Comments
Hi @DrNiels , We have reviewed your query, and to resolve the issue of the chart not loading when using a very small range difference between two data points, we recommend setting the interval property for the axis. Using this, the axis labels can be created at a specified interval, ensuring the chart renders properly. You may also consider using the decimalPlaces property to control the number of decimal digits displayed in the numeric axis labels. Code snippet:
For more details, please refer to this user guide links: Interval: https://help.syncfusion.com/flutter/cartesian-charts/axis-types#customizing-interval Decimal places: https://help.syncfusion.com/flutter/cartesian-charts/axis-types#decimal-places Regards, |
That doesn't fix the issue in my case. Here's my updated example: Code sampleimport 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
void main() async {
runApp(
MaterialApp(
home: Chart(),
),
);
}
class Chart extends StatefulWidget {
@override
State<StatefulWidget> createState() => ChartState();
}
class ChartState extends State<Chart> {
@override
Widget build(BuildContext context) {
return SfCartesianChart(
primaryYAxis: NumericAxis(
minimum: 77499.99999999999,
maximum: 77500.00000000001,
interval: 0.000000000005,
decimalPlaces: 20,
),
);
}
} The stack trace looks identical as well. But just in case I missed some fine differences, here's the new one: Stack TracesLaunching chart_reproduce.dart on Chrome in debug mode...
"it": 515 untranslated message(s).
"pt": 175 untranslated message(s).
To see a detailed report, use the untranslated-messages-file
option in the l10n.yaml file:
untranslated-messages-file: desiredFileName.txt
<other option>: <other selection>
This will generate a JSON format file containing all messages that
need to be translated.
Warning: In index.html:145: "FlutterLoader.loadEntrypoint" is deprecated. Use "FlutterLoader.load" instead. See https://docs.flutter.dev/platform-integration/web/initialization for more details.
This app is linked to the debug service: ws://127.0.0.1:50885/xtWbHFptrVc=/ws
Debug service listening on ws://127.0.0.1:50885/xtWbHFptrVc=/ws
Connecting to VM Service at ws://127.0.0.1:50885/xtWbHFptrVc=/ws
Connected to the VM Service.
Aborted()
══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following NativeError object was thrown during performLayout():
RuntimeError: Aborted(). Build with -sASSERTIONS for more info.
The relevant error-causing widget was:
NumericAxis NumericAxis:org-dartlang-app:/chart_reproduce.dart:21:21
When the exception was thrown, this was the stack:
canvaskit/chromium/canvaskit.js 93:151 Ea
canvaskit/chromium/canvaskit.js 169:377 k
canvaskit/chromium/canvaskit.js 116:52 _MakeFromFontCollection
canvaskit/chromium/canvaskit.js 75:396 MakeFromFontCollection
lib/_engine/engine/canvaskit/text.dart 1045:29 new
lib/_engine/engine/canvaskit/renderer.dart 392:7 createParagraphBuilder
lib/ui/text.dart 739:21 new
packages/flutter/src/painting/text_painter.dart 1142:44 [_createParagraph]
packages/flutter/src/painting/text_painter.dart 1198:64 layout
packages/syncfusion_flutter_core/src/utils/helper.dart 154:14 measureText
packages/syncfusion_flutter_charts/src/charts/axis/numeric_axis.dart 617:11 generateVisibleLabels
packages/syncfusion_flutter_charts/src/charts/axis/axis.dart 1952:7 performLayout
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/syncfusion_flutter_charts/src/charts/base.dart 2154:13 measureVerticalAxes
packages/syncfusion_flutter_charts/src/charts/base.dart 2170:5 performLayout
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/syncfusion_flutter_charts/src/charts/base.dart 944:23 performLayout
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/syncfusion_flutter_charts/src/charts/common/core_legend.dart 990:5 performLayout
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/shifted_box.dart 234:5 performLayout
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/shifted_box.dart 234:5 performLayout
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/proxy_box.dart 3728:13 performLayout
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/widgets/overlay.dart 1002:12 layoutChild
packages/flutter/src/widgets/overlay.dart 1311:9 performLayout
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/custom_paint.dart 569:11 performLayout
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/proxy_box.dart 111:21 <fn>
packages/flutter/src/rendering/object.dart 2608:7 layout
packages/flutter/src/rendering/view.dart 281:7 performLayout
packages/flutter/src/rendering/object.dart 2446:7 [_layoutWithoutResize]
packages/flutter/src/rendering/object.dart 1052:17 flushLayout
packages/flutter/src/rendering/object.dart 1065:14 flushLayout
packages/flutter/src/rendering/binding.dart 602:5 drawFrame
packages/flutter/src/widgets/binding.dart 1164:13 drawFrame
packages/flutter/src/rendering/binding.dart 468:5 [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1397:7 [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1318:9 handleDrawFrame
packages/flutter/src/scheduler/binding.dart 1040:9 <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:11 internalCallback
The following RenderObject was being processed when the exception was fired: RenderNumericAxis#79de7 relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT:
creator: NumericAxis ← CartesianAxes ← CartesianChartArea ← KeyedSubtree-[GlobalKey#577de] ←
_LegendLayoutHandler ← LegendLayout-[GlobalKey#625ec] ← Padding ← Padding ← DecoratedBox ←
Container ← RepaintBoundary ← SfCartesianChart ← ⋯
parentData: offset=Offset(0.0, 0.0) (can use size)
constraints: BoxConstraints(0.0<=w<=678.0, 0.0<=h<=583.0)
size: MISSING
This RenderObject has no descendants.
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_charts-27.1.50/lib/src/charts/base.dart:947:12
Aborted()
Another exception was thrown: RuntimeError: Aborted(). Build with -sASSERTIONS for more info.
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/object.dart:304:16
Aborted()
Another exception was thrown: RuntimeError: Aborted(). Build with -sASSERTIONS for more info.
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/object.dart:304:16
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Another exception was thrown: Assertion failed: file:///C:/Users/Niels/Documents/flutter/packages/flutter/lib/src/rendering/box.dart:2164:12
Aborted() Even if it would work, I consider setting an interval a workaround until the fix and not a solution, even though a workaround would have been nice as well. In addition, the error occurs as well if I don't set minimum and maximum and the values of a series ranges in a corresponding small range, which would require some additional preparation when using a chart instead of simple dumping the values inside, no matter how small the range. |
Hi DrNeils, We have validated the reported issue, and it's occurring due to a very small difference between the data points. The difference between the data points 77499.99999999999 and 77500.00000000001 is 0.00000000002. This small difference results from the precision limitations inherent in floating-point arithmetic. To avoid this issue, we suggest using an interval property value of 0.01 for the axis. Currently, we don’t support handling large decimals, but we have already logged a feature request for it in our feedback portal. We will prioritize the features of every release based on demand and priority, so this feature will be available in one of our upcoming releases. You can also track the status of the feature using the feedback link below. Feedback Link: https://www.syncfusion.com/feedback/51656/support-to-render-the-chart-with-having-large-decimal-data Regards, |
I would consider this a bug and not a feature as it causes crashes. For now, I guess I'll need to handle this special case manually, so my app doesn't crash. |
Bug description
When trying to create an axis with a very small range, e.g., from 77499.99999999999 to 77500.00000000001, the chart is not loaded. After some wait duration, an error is thrown. In my case, the duration is approximately 30 seconds and the stack trace also looks like some kind of timeout to me.
I use syncfusion_flutter_charts in version 27.1.50
Steps to reproduce
Load the example and wait a bit.
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
Nothing to see, it remains a blank screen
Stack Traces
Stack Traces
On which target platforms have you observed this bug?
Web
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: