-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeasurement_chart.dart
56 lines (52 loc) · 1.71 KB
/
Measurement_chart.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:screen1/Measurement.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'Measurement.dart';
import 'Tank.dart';
class MeasurementChart extends StatelessWidget {
final List<Measurement> data;
final Tank tank;
MeasurementChart({@required this.data, @required this.tank});
@override
Widget build(BuildContext context) {
// TODO: implement build
List<charts.Series<Measurement, num>> misurazioni = [
charts.Series(
id: 'Misurazioni',
data: data,
domainFn: (Measurement m, _) => m.createdat,
measureFn: (Measurement m, _) => m.data,
colorFn: (Measurement m, _) => m.barColor)
];
return SizedBox(
height: 300,
child: Container(
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1.5, color: Color.fromARGB(255, 160, 25, 29)),
)
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
borderOnForeground: false,
shadowColor: Colors.white,
elevation: 0,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Expanded(
child: charts.LineChart(misurazioni, animate: true),
),
],
),
),
),
)
)
);
}
}