-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Throws exception if number of points on the x-axis = 1 #1053
Labels
Comments
imaNNeo
added a commit
that referenced
this issue
Jun 10, 2022
imaNNeo
added a commit
that referenced
this issue
Jun 10, 2022
Please use markdown features to write your description. Now you have mentioned 144 issues in your description wrongly. |
And your provided code is not readable. |
imaNNeo
added a commit
that referenced
this issue
Jun 10, 2022
See here for how to quote code and here for the auto referencing issue neoFight mentioned. Code samples in issues should also be properly formatted with adequate spacing/tabbing such as: import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
home: Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 100, 20, 0),
child: SizedBox(
height: 200,
child: LineChart(
LineChartData(
gridData: FlGridData(
show: true,
),
titlesData: FlTitlesData(
show: true,
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 40,
interval: 2,
getTitlesWidget: (double value, TitleMeta titleMeta) {
return Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
value.toString(),
),
);
},
),
),
leftTitles: AxisTitles(sideTitles: SideTitles()),
topTitles: AxisTitles(sideTitles: SideTitles()),
rightTitles: AxisTitles(sideTitles: SideTitles()),
),
lineBarsData: [
LineChartBarData(
spots: [
const FlSpot(1, 2),
],
isCurved: false,
barWidth: 1,
isStrokeCapRound: true,
dotData: FlDotData(
show: true,
),
),
],
),
),
),
),
),
),
),
); |
Merged
Fixed in 0.55.0. Please check it out! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I have a problem, if number of points on the x-axis = 1, in this case I can see only a point on a graph, but I can't see titles on the axis.
Doctor summary
[✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-arm, locale ru)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Community Edition (version 2021.1.3)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
Reproduction code:
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() => runApp(
MaterialApp(
home: Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 100, 20, 0),
child: SizedBox(
height: 200,
child: LineChart(
LineChartData(
gridData: FlGridData(
show: true,
),
titlesData: FlTitlesData(
show: true,
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 40,
interval: 2,
getTitlesWidget: (double value, TitleMeta titleMeta) {
return Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
value.toString(),
),
);
},
),
),
leftTitles: AxisTitles(sideTitles: SideTitles()),
topTitles: AxisTitles(sideTitles: SideTitles()),
rightTitles: AxisTitles(sideTitles: SideTitles()),
),
lineBarsData: [
LineChartBarData(
spots: [
const FlSpot(1, 2),
],
isCurved: false,
barWidth: 1,
isStrokeCapRound: true,
dotData: FlDotData(
show: true,
),
),
],
),
),
),
),
),
),
),
);
======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
Offset argument contained a NaN value.
'dart:ui/painting.dart':
Failed assertion: line 43 pos 10: ''
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
The relevant error-causing widget was:
Text Text:file:///Users/kuznetsov7/Desktop/programming/flutter/examples/hello_world/lib/main.dart:32:38
When the exception was thrown, this was the stack:
#2 _offsetIsValid (dart:ui/painting.dart:43:10)
#3 Canvas.drawParagraph (dart:ui/painting.dart:4741:12)
#4 TextPainter.paint (package:flutter/src/painting/text_painter.dart:696:12)
#5 RenderParagraph.paint (package:flutter/src/rendering/paragraph.dart:742:18)
#6 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#7 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#8 RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#9 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#10 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#11 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#12 AxisSideTitlesRenderFlex.paint (package:fl_chart/src/chart/base/axis_chart/side_titles/side_titles_flex.dart:252:5)
#13 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#14 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#15 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#16 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#17 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#18 RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#19 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#20 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#21 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#22 RenderFlex.paint (package:flutter/src/rendering/flex.dart:1078:7)
#23 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#24 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#25 RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#26 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#27 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#28 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#29 RenderStack.paintStack (package:flutter/src/rendering/stack.dart:611:5)
#30 RenderStack.paint (package:flutter/src/rendering/stack.dart:627:7)
#31 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#32 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#33 _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:340:15)
#34 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#35 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#36 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#37 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#38 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#39 RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#40 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#41 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#42 RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#43 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#44 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#45 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#46 RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:408:5)
#47 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#48 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#49 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#50 _RenderInkFeatures.paint (package:flutter/src/material/material.dart:598:11)
#51 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#52 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#53 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#54 PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:387:12)
#55 RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:1951:15)
#56 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#57 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#58 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#59 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#60 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#61 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#62 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#63 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#64 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#65 PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:198:7)
#66 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:185:7)
#67 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#68 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#69 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#70 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2844:15)
#71 RenderStack.paintStack (package:flutter/src/rendering/stack.dart:611:5)
#72 RenderStack.paint (package:flutter/src/rendering/stack.dart:627:7)
#73 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#74 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#75 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#76 RenderDecoratedBox.paint (package:flutter/src/rendering/proxy_box.dart:2191:11)
#77 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#78 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#79 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#80 RenderFractionalTranslation.paint (package:flutter/src/rendering/proxy_box.dart:2806:13)
#81 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#82 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#83 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#84 RenderFractionalTranslation.paint (package:flutter/src/rendering/proxy_box.dart:2806:13)
#85 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#86 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#87 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#88 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#89 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#90 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#91 PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:198:7)
#92 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:185:7)
#93 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#94 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#95 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#96 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#97 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#98 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#99 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#100 RenderOffstage.paint (package:flutter/src/rendering/proxy_box.dart:3475:11)
#101 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#102 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#103 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#104 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#105 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#106 _RenderTheatre.paintStack (package:flutter/src/widgets/overlay.dart:786:15)
#107 _RenderTheatre.paint (package:flutter/src/widgets/overlay.dart:804:7)
#108 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#109 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#110 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#111 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#112 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#113 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#114 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#115 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#116 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#117 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#118 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#119 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#120 RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:608:11)
#121 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#122 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#123 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#124 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#125 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#126 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#127 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#128 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#129 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#130 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#131 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#132 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#133 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#134 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:187:13)
#135 RenderView.paint (package:flutter/src/rendering/view.dart:209:15)
#136 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2477:7)
#137 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#138 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#139 PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:995:29)
#140 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:506:19)
#141 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:892:13)
#142 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:370:5)
#143 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1146:15)
#144 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1083:9)
#145 SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:864:7)
If I add FlSpot(1,7) - I will get the same result, but if I add FlSpot(2,7) - everything will be OK
The text was updated successfully, but these errors were encountered: