You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
import 'package:flutter/material.dart';
|
|
import 'package:healthcare_user/common/settings.dart';
|
|
import 'package:charts_flutter/flutter.dart' as charts;
|
|
import 'package:healthcare_user/models/bmi_history_model.dart';
|
|
|
|
|
|
class BmiChart extends StatefulWidget {
|
|
var myObject;
|
|
BmiChart({
|
|
this.myObject
|
|
});
|
|
|
|
@override
|
|
State<BmiChart> createState() => _BmiChartState();
|
|
}
|
|
|
|
class _BmiChartState extends State<BmiChart> {
|
|
|
|
|
|
_getSeriesData() {
|
|
List<charts.Series<BmiHistoryModel, DateTime>> series = [
|
|
charts.Series(
|
|
id: "Bmi",
|
|
data: widget.myObject,
|
|
domainFn: (BmiHistoryModel series, _) => series.dateForFilter,
|
|
measureFn: (BmiHistoryModel series, _) => series.number2,
|
|
colorFn: (BmiHistoryModel series, _) => charts.MaterialPalette.blue.shadeDefault
|
|
)
|
|
];
|
|
return series;
|
|
}
|
|
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppSettings.appBar('BMI Chart'),
|
|
body: Container(
|
|
|
|
child:new charts.TimeSeriesChart(_getSeriesData(), animate: true,),
|
|
|
|
),
|
|
);
|
|
}
|
|
}
|