mirrored_repositories/Expenses_Tracker_App/lib/screens
import 'package:expenses_tracker/utils/constants/colors.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';

class Chart extends StatefulWidget {
  const Chart({super.key});

  @override
  // ignore: library_private_types_in_public_api
  _ChartState createState() => _ChartState();
}

class _ChartState extends State<Chart> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: 300,
      child: SfCartesianChart(
        primaryXAxis: const CategoryAxis(),
        series: <SplineSeries<SalesData, String>>[
          SplineSeries<SalesData, String>(
            color: EColors.primary,
            dataSource: <SalesData>[
              SalesData(100, "Mo"),
              SalesData(20, "Tu"),
              SalesData(40, "We"),
              SalesData(15, "Th"),
              SalesData(50, "Fr"),
              SalesData(15, "St"),
              SalesData(5, "Sn"),
            ],
            xValueMapper: (SalesData sales, _) => sales.year,
            yValueMapper: (SalesData sales, _) => sales.sales,
          ),
        ],
      ),
    );
  }
}

class SalesData {
  final String year;
  final int sales;
  SalesData(
    this.sales,
    this.year,
  );
}
