We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Can't show waves after app boot up?

Hi,

The app I built for SfCartesianChart can't show waves after boot up, have to click 'hot reload' button in the debugger (running on my computer) to show.

Any ideas on solving this?


11 Replies 1 reply marked as answer

YG Yuvaraj Gajaraj Syncfusion Team January 19, 2023 04:07 PM UTC

Hi Zhu,


We have checked your query at our end and, as we are not able to understand what you are proposing as your requirement, we kindly request that you share more information on your requirement in detail, along with screenshots or screen recordings, so that it will help us to assist you in a better way.


Regards,

Yuvaraj.



ZH Zhu replied to Yuvaraj Gajaraj January 20, 2023 02:03 PM UTC

Hi,  Yuvaraj,

I'm using flutter and vscode to build my app which use SfCartesianChart, it's in debug state by now.

After I click F5 (which means start debugging) , flutter would build the app and install it to my Android phone and start debugging, it should display the charts on screen, but there are only the the title, axises and legends, no charts, I have to click the 'hot reload' button in vscode's debug tool bar, then the charts can also be displayed.

Looks like the charts are actually ready, they just need a redraw (by hot reload or change the phone's direction) to be displayed.

By the way, I run my async load data fuction wraped in Future.delayed in initState() of the stateful widget that have SfCartesianChart inside it, it does not matter, right?


Regards,

Zhu



YG Yuvaraj Gajaraj Syncfusion Team January 23, 2023 12:56 PM UTC

Hi Zhu,


We tried to replicate the reported issue by calling the loadData method within the Future.delayed method with a 2-second time duration and it is working fine, the chart renders properly. Unfortunately, we were not able to reproduce the reported issue as we are not exactly sure in what scenario the issue is occurring. So, we kindly request you to try to reproduce the reported issue using the test sample attached below and revert back to us. This will help us assist you in a better way.


Regards,

Yuvaraj.


Attachment: f180060_4ab6564f.zip


ZH Zhu January 24, 2023 06:57 AM UTC

Hi,  Yuvaraj,

Thank you for providing the test sample, I tried it and it works well here.


Here's my app's initState code:

void initState() {

    Future.delayed(Duration.zero, () async {

      await readFile();

      loadData();

    });

    super.initState();

  }

I tried to put  super.initState() in front of the  Future.delayed part, still can't display charts by itself.


Regards,

Zhu




YG Yuvaraj Gajaraj Syncfusion Team January 25, 2023 02:40 PM UTC

Hi Zhu,


We have checked your code snippet and the reported issue is not reproduced at our end. Due to minimal information, we can't able to provide you a solution earlier. So, we kindly request you to provide more information about your chart code with the data source and screenshot or screen record. Also, try to reproduce the issue in a shared sample and get back to us it will be more helpful to us to assist you in a better way.



Regards,

Yuvaraj




ZH Zhu replied to Yuvaraj Gajaraj January 26, 2023 11:07 AM UTC

Hi, Yuvaraj,

Thanks for the help, I'll  try to reproduce the issue in a shared sample and get back to you.


Regards,

Zhu



ZH Zhu January 27, 2023 04:10 AM UTC

Hi, Yuvaraj,

Attached is the app files(except the build folders), please take a check.

Another issue:

Using FastLineSeries ( changing series: getData to series: getData1) would bring below 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 184 pos 14: 'seriesPoints.isNotEmpty'


The relevant error-causing widget was SfCartesianChart

lib\main.dart:48

════════════════════════════════════════════════════════════════════════════════


Regards,

Zhu


Attachment: tests_42f7c7e5.zip


ZH Zhu January 27, 2023 06:18 AM UTC

Hi, Yuvaraj,


Sorry, forgot to attach the data file, here it is.

Extract it to Android phone path of  '/data/user/0/com.example.tests/files', then the app can work.


Regards,

Zhu


Attachment: 17_54adf0dd.zip


YG Yuvaraj Gajaraj Syncfusion Team January 27, 2023 03:17 PM UTC

Hi Zhu,


We have checked your sample and it is not in a runnable state, then we checked your code snippet and found that you have called the read() in the Future.delaved, and returned the chart inside the build method, so the chart gets rendered before the read and loadData method get called. Here, the read() method will get called after some time due to being wrapped inside the Future.delaved. To resolve this issue, we suggest returning the chart widget inside the FutureBuilder build method when the snapshot argument has data and assigning the read() function to the future property in the FutureBuilder. This way, the chart will be rendered at the initial startup. We have shared the FutureBuilder sample link and simple sample below for your reference.


https://api.flutter.dev/flutter/widgets/FutureBuilder-class.html#widgets.FutureBuilder.1


Regards,

Yuvaraj.


Attachment: f180060_af6feec1.zip

Marked as answer

ZH Zhu January 30, 2023 08:14 AM UTC

Hi, Yuvaraj,


Problem solved, thank you so much for the kind help.


Best Regards,

Zhu



YG Yuvaraj Gajaraj Syncfusion Team January 30, 2023 01:37 PM UTC

Hi Zhu,


Most Welcome. Kindly get back to us if you have further queries. We are always happy to assist you.


Regards,

Yuvaraj.


Loader.
Live Chat Icon For mobile
Up arrow icon