JacobJust / fl_animated_linechart

Animated line chart for flutter
MIT License
53 stars 29 forks source link

Error when data length is 1 #20

Open hsynaksu opened 4 years ago

hsynaksu commented 4 years ago

Hi there! Great library

Only issue I have is when length of the data map is only 1, my layout shifts weirdly and I get this error:

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 38: ''

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=BUG.md

The relevant error-causing widget was AnimatedLineChart-[#5c159] lib\…\anomaly_tag_screens\wristbands_screen.dart:190 When the exception was thrown, this was the stack

2 _offsetIsValid (dart:ui/painting.dart:38:10)

3 Canvas.drawCircle (dart:ui/painting.dart:3643:12)

4 ChartPainter._drawLines.. (package:fl_animated_linechart/chart/animated_line_chart.dart:351:40)

5 List.forEach (dart:core-patch/growable_array.dart:285:8)

6 ChartPainter._drawLines. (package:fl_animated_linechart/chart/animated_line_chart.dart:351:18)

... The following RenderObject was being processed when the exception was fired: RenderCustomPaint#996d4 RenderObject: RenderCustomPaint#996d4 parentData: (can use size) constraints: BoxConstraints(w=330.0, h=229.5) size: Size(330.0, 229.5)

happyphper commented 4 years ago

+1

JFreakDK commented 4 years ago

It would be nice if you could create a pull request that handles this case