fl_chart
fl_chart copied to clipboard
[Live graph] Errors such as noise in the live graph
When I use the live graph with the value Double, the phenomenon like the video occurs. The initial signal will fill until full (100 point limit), at which point the graph displays normally. When it's full, the item is deformed and noisy.
I modified the word /line_chart_sample10.dart and replaced it with this code:
sinPoints.add(FlSpot(xValue, random.nextDouble()));
cosPoints.add(FlSpot(xValue, random.nextDouble()));
Hope to get support soon.
https://github.com/imaNNeo/fl_chart/assets/94666344/cc19c55b-f56d-48b2-9fc2-8cf10097f91b
I do have a project that worked fine with fl_charts 0.55.2 and flutter 3.16.0 (dart 3.2.0). (Note: amplitude changes are due to auto scaling.)
https://github.com/imaNNeo/fl_chart/assets/9976628/607041c3-6b57-41c6-bfb4-ffc12561c9bf
Now I am using fl_charts 0.66.2 and flutter 3.22.2 (dart 3.4.3) and see the same junky graph.
@imaNNeo After some testing I found the problem is introduced in fl_charts version 0.63.0. Edit 2: I tried using random values as @SAOKIM99 did, while trying any of the here mentioned versions of fl_charts and flutter, and all show noise behavior.
See how the graph changes when I stop the scrolling for a moment:
https://github.com/imaNNeo/fl_chart/assets/9976628/abc7825a-25aa-4cee-ba05-7845959ed3fd
Edit 1: I just tried flutter 3.22.2 with fl_chart 0.62.0 (only needed to replace MediaQuery.boldTextOverride with MediaQuery.boldTextOf) but I see the same noises behavior.
@SAOKIM99 can you try if adding duration: Duration.zero,
to LineChart(...)
solves the issue for you?
I just tried with the example app and it looks okay.
https://github.com/imaNNeo/fl_chart/assets/9976628/e4dbf972-2334-4289-9c93-c00e3ec0fb24
This issue was also mentioned and solved on stackoverflow.
The parameter duration
was called swapAnimationDuration
before version 0.66.0.
Yes exactly, you need to set duration: Duration.zero
to fix this issue.
Thanks @felixdollack for contributing!