i'm having issue with fastline series chart, it showing error as "Invalid arguments(s)"

import 'package:chartdemo/api.dart';
import 'package:chartdemo/model.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:syncfusion_flutter_charts/charts.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  //ChartData chartdataS = ChartData();
  List<Datum> listitem = [];
  Future<ChartData> data;

  // void getChartData() async {
  //   chartdataS = await chartService('BTC');
  //   listitem.addAll(chartdataS.data);
  // }

  @override
  void initState() {
    super.initState();
    data = chartService('BTC');
    //getChartData();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(),
        body: Column(
          children: [
            Container(
              height: 300,
              //width: MediaQuery.of(context).size.width - 2,
              child: Card(
                elevation: 2,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(15.0),
                ),
                child: Center(
                    child: Padding(
                  padding: const EdgeInsets.all(10.0),
                  child: Container(
                    //width: MediaQuery.of(context).size.width - 40,
                    child: FutureBuilder<ChartData>(
                      future: data,
                      builder: (context, snapshot) {
                        if (snapshot.data != null) {
                          return Container(
                            child: SfCartesianChart(
                              plotAreaBorderWidth: 0,
                              //title: ChartTitle(text: isCardView ? '' : 'Sales comparison'),
                              legend: Legend(
                                  //isVisible: true,
                                  //isVisible: isCardView ? false : true,
                                  overflowMode: LegendItemOverflowMode.scroll),
                              primaryXAxis: DateTimeAxis(
                                  //isVisible: false,
                                  interval: 5,
                                  //edgeLabelPlacement: EdgeLabelPlacement.shift,
                                  intervalType: DateTimeIntervalType.seconds,
                                  dateFormat:
                                      DateFormat('''MM/dd/yy\nh:mm a'''),
                                  name: 'Years',
                                  majorGridLines: MajorGridLines(width: 0)),
                              primaryYAxis: NumericAxis(
                                  //isVisible: false,
                                  //minimum: 80,
                                  // maximum: 110,
                                  //interval: 500,
                                  rangePadding: ChartRangePadding.none,
                                  name: 'Price',
                                  axisLine: AxisLine(width: 0),
                                  majorTickLines: MajorTickLines(
                                      color: Colors.transparent)),
                              series: <FastLineSeries<DatumDateTime>>[
                                FastLineSeries<DatumDateTime>(
                                  dataSource: snapshot.data.data,
                                  xValueMapper: (Datum data, _) =>
                                      DateTime(data.date),
                                  yValueMapper: (Datum data, _) => data.low,
                                ),
                              ],
                              trackballBehavior: TrackballBehavior(
                                  enable: true,
                                  lineColor: Colors.indigo,
                                  lineWidth: 0,
                                  activationMode: ActivationMode.singleTap,
                                  markerSettings: TrackballMarkerSettings(
                                      borderWidth: 4,
                                      height: 10,
                                      width: 10,
                                      markerVisibility:
                                          TrackballVisibilityMode.visible)),
                            ),
                          );
                        }
                        return Container(
                          child: CircularProgressIndicator(),
                        );
                      },
                    ),
                  ),
                )),
              ),
            ),
          ],
        ),
      ),
    );
  }
}





i'm getting data from api calling and using future builder im push that data into sfcartesianchart as data source and its worked perfectrly
for two days and then its suddenly gives an error as i mentioned in subject and i attached screenshot too in zip file. and here is my code as
above.

Attachment: WhatsApp_Image_20210422_at_11.48.31_AM_2f201c5a.zip

5 Replies 1 reply marked as answer

DP Dharanitharan Palanisamy Syncfusion Team April 23, 2021 10:46 AM UTC

Hi Nikunj, 
 
Greetings from the team at Syncfusion. We've looked over your question and the code you sent, and we're happy to report that the FastLineSeries is made correctly and without errors. We discovered that you are passing the date-time value in milliseconds from the provided image to the data source and that you are processing this millisecond (int) value in your code xValueMapper: (Datum data, _) => DateTime(data.date), so we had a compile-time issue, which we fixed by converting milliseconds to DateTime and binding it to the chart. As a result, we assume you're passing this int value to the DateTimeAxis, which will result in the 'invalid arguments' error. Please feel free to use the altered sample that we have attached. 
 
 
Please revert us if you need any further assistance. 
 
Thanks, 
Dharanitharan. P 


Marked as answer

NS Nikunj Sudani April 29, 2021 06:43 AM UTC

thank you...
  it's really helpful 


DP Dharanitharan Palanisamy Syncfusion Team April 29, 2021 10:58 AM UTC

Hi Nikunj, 
 
Most welcome, and we are happy that the provided solution has been of assistance to you, please contact us if you need any additional help and we are always happy to assist. 
 
Thanks, 
Dharanitharan. P 



NS Nikunj Sudani May 4, 2021 06:30 AM UTC

hello,
i need your help again.
when i set my locale in RTL like arabic language it's not gives an error but chart does not visible i attached both the screenshot RTL and LTR what should i do in this case.

thank you.

Attachment: ss_da7053ee.zip


DP Dharanitharan Palanisamy Syncfusion Team May 5, 2021 06:08 AM UTC

Hi Nikunj, 
 
We have looked into your request and are happy to inform you that the reported problem has been fixed in our charts. Please check with the most recent version of our charts to ensure that everything is working properly, and please let us know if you need any additional assistance. 
 
 
Thanks, 
Dharanitharan. P 


Loader.
Up arrow icon