forked from fossasia/pslab-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchart_data_points.dart
More file actions
42 lines (35 loc) · 781 Bytes
/
Copy pathchart_data_points.dart
File metadata and controls
42 lines (35 loc) · 781 Bytes
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
class ChartDataPoint {
final double x;
final double y;
ChartDataPoint(this.x, this.y);
@override
String toString() => 'ChartDataPoint(x: $x, y: $y)';
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is ChartDataPoint && other.x == x && other.y == y;
}
@override
int get hashCode => Object.hash(x, y);
factory ChartDataPoint.fromMap(Map<String, dynamic> map) {
return ChartDataPoint(
map['x']?.toDouble() ?? 0.0,
map['y']?.toDouble() ?? 0.0,
);
}
Map<String, dynamic> toMap() {
return {
'x': x,
'y': y,
};
}
ChartDataPoint copyWith({
double? x,
double? y,
}) {
return ChartDataPoint(
x ?? this.x,
y ?? this.y,
);
}
}