Improved stacked graph

This commit is contained in:
2024-02-11 22:49:57 +01:00
parent cbaf94d866
commit a51ca14041
5 changed files with 118 additions and 24 deletions

View 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;
}
}