imaNNeo / fl_chart

FL Chart is a highly customizable Flutter chart library that supports Line Chart, Bar Chart, Pie Chart, Scatter Chart, and Radar Chart.
https://flchart.dev
MIT License
6.74k stars 1.74k forks source link

Real-time Data Line Chart Graph UI Blinking Issues #1064

Open jaehyeokjeong opened 2 years ago

jaehyeokjeong commented 2 years ago

Hi. Bluetooth receives real-time data(100Hz) and outputs graphs through a line graph library(LineChart). The UI will update normally for about 10 minutes, but the UI will start blinking little by little and start to deteriorate (the graph will disappear and reappear after about 3 hours). I wonder if this problem is a memory leak or if it is improved by modifying other hyperparameters.

imaNNeo commented 2 years ago

You have to apply a limitation on your storing data. For example, you can keep only 100 last items and remove old data from your stored data, and show it. That's the way.

Check out our realtime sin/cos chart:

Sample 10 (Source Code)
jaehyeokjeong commented 2 years ago

When more than 100 data are filled through the removeAt(0) method, the data is managed by erasing the 0th index. After running the line chart for approximately two days, the application stopped.(Memory: 3.3 gigabytes) As a result of checking through flutter dev tools, the starting memory was about 250 megabytes, but when the app stopped, it went up to 3 gigabytes.

https://user-images.githubusercontent.com/56542093/174521033-489e0850-380d-4a19-8454-aa20ca216c61.mp4

usmankhatri-blinkx commented 2 months ago

try adding the animation to the chart -> for example

LineChart( mainData(), duration: firsTime ? const Duration(milliseconds: 200) : const Duration(seconds: 0), curve: Curves.linear, ),