File tree 1 file changed +20
-3
lines changed
1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,15 @@ import 'package:flutter/material.dart';
10
10
import '../models/node.dart' ;
11
11
import '../theme.dart' ;
12
12
13
+ const colors = [
14
+ Color (0xff005e83 ),
15
+ Color (0xff00a072 ),
16
+ Color (0xfff7b500 ),
17
+ Color (0xffe06f00 ),
18
+ Color (0xffbb1f11 ),
19
+ Color (0xff883e8d ),
20
+ ];
21
+
13
22
class LiveChart extends StatelessWidget {
14
23
final NodeModel node;
15
24
final startTime = DateTime .now ().millisecondsSinceEpoch;
@@ -21,6 +30,14 @@ class LiveChart extends StatelessWidget {
21
30
22
31
LiveChart ({super .key, required this .node});
23
32
33
+ Color _getChipColor (String name) {
34
+ if (node.selectedSeries.contains (name)) {
35
+ return colors[node.selectedSeries.indexOf (name) % colors.length];
36
+ } else {
37
+ return Colors .grey;
38
+ }
39
+ }
40
+
24
41
@override
25
42
Widget build (BuildContext context) {
26
43
return Column (
@@ -52,6 +69,7 @@ class LiveChart extends StatelessWidget {
52
69
}
53
70
},
54
71
showCheckmark: false ,
72
+ selectedColor: _getChipColor (name),
55
73
))
56
74
.toList (),
57
75
),
@@ -123,9 +141,8 @@ class LiveChart extends StatelessWidget {
123
141
LineChartBarData (
124
142
spots: node.timeseries[series]! ,
125
143
isCurved: true ,
126
- gradient: LinearGradient (
127
- colors: gradientColors,
128
- ),
144
+ preventCurveOverShooting: true ,
145
+ color: colors[node.selectedSeries.indexOf (series) % colors.length],
129
146
barWidth: 3 ,
130
147
isStrokeCapRound: true ,
131
148
dotData: const FlDotData (
You can’t perform that action at this time.
0 commit comments