added more blocs
This commit is contained in:
@@ -42,17 +42,29 @@ class MonthlyCategoriesTotalChart extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
double _computeMaxValue() {
|
||||
double max = 0.0;
|
||||
categoriesMonthlyTotals.forEach((monthKey, value) {
|
||||
double localMax = value.values.reduce((value, element) => value + element);
|
||||
if (localMax > max) {
|
||||
max = localMax;
|
||||
}
|
||||
});
|
||||
return max + (max / 10);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AspectRatio(
|
||||
aspectRatio: 1.66,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final barsSpace = 4.0 * constraints.maxWidth / 400;
|
||||
final barsWidth = 8.0 * constraints.maxWidth / 100;
|
||||
final barsSpace = 4.0 * constraints.maxWidth / 100;
|
||||
final barsWidth = 8.0 * constraints.maxWidth / 130;
|
||||
|
||||
return BarChart(
|
||||
BarChartData(
|
||||
maxY: _computeMaxValue(),
|
||||
barGroups: _computeBarGroups(barsSpace, barsWidth),
|
||||
titlesData: FlTitlesData(
|
||||
topTitles: const AxisTitles(
|
||||
|
||||
Reference in New Issue
Block a user