import 'package:flutter/material.dart';
//import 'package:flutter_sparkline/flutter_sparkline.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
import "main.dart";

class ChartSampleData {
  ChartSampleData({this.x, this.yValue});

  final DateTime? x;
  final double? yValue;
}

class CardServerkontakt extends StatelessWidget {
   CardServerkontakt({super.key});

  List<ChartSampleData> chartData = <ChartSampleData>[
  ChartSampleData(x: DateTime(2015, 1, 1, 0), yValue: 1),
  ChartSampleData(x: DateTime(2015, 1, 2, 2), yValue: 1),
  ChartSampleData(x: DateTime(2015, 1, 3, 3), yValue: 0),
  ChartSampleData(x: DateTime(2015, 1, 4, 4), yValue: 0),
  ChartSampleData(x: DateTime(2015, 1, 5, 5), yValue: 0),
  ChartSampleData(x: DateTime(2015, 1, 6, 6), yValue: 1),
  ChartSampleData(x: DateTime(2015, 1, 7, 7), yValue: 1),
  ChartSampleData(x: DateTime(2015, 1, 8, 8), yValue: 1),
  ChartSampleData(x: DateTime(2015, 1, 9, 9), yValue: 0),
  ChartSampleData(x: DateTime(2015, 1, 10, 10), yValue: 1),
  ];

  @override
  Widget build(BuildContext context) {

    return Card(
      child: Padding(
        padding: const EdgeInsets.all(8),
        child: Column(
         // mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[

         ListTile(
          title: Text(context.sp.serverkontakt),
          //subtitle: Text(subheading),
          //trailing: Icon(Icons.favorite_outline),
        ),


            SizedBox(
                height: 100,
                //width: 520,
                //child: SfSparkLineChart(
                child: SfCartesianChart(
                    backgroundColor: Colors.white,
                    //Specifying date time interval type as hours
                    primaryXAxis: const DateTimeAxis(
                        majorGridLines: MajorGridLines(width: 0),
                        edgeLabelPlacement: EdgeLabelPlacement.shift,
                        intervalType: DateTimeIntervalType.hours),
                    primaryYAxis: const NumericAxis(maximum: 1),
                    series: <LineSeries<ChartSampleData, DateTime>>[
                      LineSeries<ChartSampleData, DateTime>(
                        dataSource: chartData,
                        xValueMapper: (ChartSampleData sales, _) => sales.x,
                        yValueMapper: (ChartSampleData sales, _) => sales.yValue,
                        name: 'Sales',
                      )
                    ]
        )
      ),

            //Text("${pet.age} Jahre"),
          ],
        ),
      ),
    );



  }
}
