Blinking Chart when refreshing screen

Hi

I am recording Live data and displaying the data Live on the chart.

New data gets added to the FastLineSeries every 5 seconds.

So, what I did was to call setState() every 5 seconds and the whole chart blinks/flashes as it re-draw the first data to the last data. Maybe it has to do with the animation or timing? But can I have the chart showing the series and add new points without the whole screen blinking?


Hope to hear from you soon.


6 Replies 1 reply marked as answer

YG Yuvaraj Gajaraj Syncfusion Team October 1, 2021 03:21 PM UTC

Hi Peter 
 
Greetings from Syncfusion. We have analyzed your scenario at our end, and we suspect that you are referring the animation as a flickering, you can disable the animation by specifying the animationDuration as zero in the series. And we recommend to you use the updateDataSource method instead of setState, because while calling the setStabte method it will render whole chart again, but in updateDataSource method it only updates the specific point only and internally we have ignored some unwanted code execution for updating the series alone. We have created a simple chart sample with updateDataSource method below for your reference.  
 
 
Regards 
Yuvaraj 


Marked as answer

PE Peter October 11, 2021 03:04 AM UTC

I tried calling the function but I get the following error:


════════ Exception caught by rendering library ═════════════════════════════════

The data points should be available to render fast line series.

'package:syncfusion_flutter_charts/src/chart/series_painter/fastline_painter.dart':

package:syncfusion_flutter_charts/…/series_painter/fastline_painter.dart:1

Failed assertion: line 188 pos 14: 'seriesPoints.isNotEmpty'


The relevant error-causing widget was

SfCartesianChart


Another exception was thrown: The data points should be available to render fast line series.


The following RenderObject was being processed when the exception was fired: RenderCustomPaint#3c13a relayoutBoundary=up2:

  creator: CustomPaint ← RepaintBoundary ← Container ← Stack ← Container ← DecoratedBox ← Container ←

    DecoratedBox ← ConstrainedBox ← Container ← Listener ← _GestureSemantics ← ⋯

  parentData: <none> (can use size)

  constraints: BoxConstraints(0.0<=w<=1017.9, 0.0<=h<=499.0)

  size: Size(0.0, 0.0)

This RenderObject has no descendants.



Any hints?





PE Peter October 11, 2021 06:55 AM UTC

Ok, I resolve this as I was not doing it correctly.



YG Yuvaraj Gajaraj Syncfusion Team October 11, 2021 11:17 AM UTC

Hi Peter, 
 
Happy to hear the issue has been resolved at your end. Kindly get back to us, if you need further assistance. We are always happy in assisting you. 
 
Thanks, 
Yuvaraj. 



?? ?? replied to Peter June 3, 2023 12:02 PM UTC

How did you solve this problem, I also encountered the same problem.



YG Yuvaraj Gajaraj Syncfusion Team June 5, 2023 01:18 PM UTC

In the FastLineSeries it will remove the closest data points from the data source and render a series. So when using the FastLineSeries the data source list must be not empty, at least you have one data item otherwise it will through an assertion error.


Loader.
Up arrow icon