Improved stacked graph
This commit is contained in:
29
lib/domains/charts/models/month_totals.dart
Normal file
29
lib/domains/charts/models/month_totals.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
class MonthTotals {
|
||||
Map<String, double> positives;
|
||||
Map<String, double> negatives;
|
||||
|
||||
MonthTotals({
|
||||
required this.positives,
|
||||
required this.negatives,
|
||||
});
|
||||
|
||||
double maxValue() {
|
||||
double max = 0.0;
|
||||
|
||||
if (positives.isNotEmpty) {
|
||||
double localMax = positives.values.reduce((value, element) => value + element);
|
||||
if (localMax > max) {
|
||||
max = localMax;
|
||||
}
|
||||
}
|
||||
|
||||
if (negatives.isNotEmpty) {
|
||||
double localMax2 = negatives.values.reduce((value, element) => value + element);
|
||||
if (localMax2 > max) {
|
||||
max = localMax2;
|
||||
}
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user