ELEC60013-ES-CW1/App/lib/view/steps/steps_chart.dart
2022-03-07 23:28:43 +00:00

29 lines
839 B
Dart

import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:leg_barkr_app/model/steps_series.dart';
class StepsChart extends StatelessWidget {
List<StepsSeries> data;
StepsChart(this.data);
@override
Widget build(BuildContext context) {
List<charts.Series<StepsSeries, String>> series = [
charts.Series(
id: "Steps",
data: data,
domainFn: (StepsSeries series, _) => series.date.day.toString() + "/" + series.date.month.toString(),
measureFn: (StepsSeries series, _) => series.steps,
colorFn: (StepsSeries series, _) => charts.ColorUtil.fromDartColor(Colors.green)
)
];
return Container(
height: 600,
width: double.infinity,
child: charts.BarChart(series, animate: true)
);
}
}