Skip to content

Commit

Permalink
[#146] [RF] Improve Forecast Chart. Fix height
Browse files Browse the repository at this point in the history
  • Loading branch information
lyskouski committed Aug 20, 2023
1 parent e6ae9fe commit a28a3fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/charts/forecast_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ForecastData {

class ForecastChart extends StatefulWidget {
final double width;
final double height;
final double indent;
final String tooltip;
final List<ForecastData> data;
Expand All @@ -24,6 +25,7 @@ class ForecastChart extends StatefulWidget {
required this.data,
required this.yMax,
required this.width,
required this.height,
this.indent = 0.0,
this.tooltip = '',
});
Expand All @@ -36,7 +38,7 @@ class ForecastChartState extends State<ForecastChart> {
@override
Widget build(BuildContext context) {
final now = DateTime.now();
final size = Size(widget.width, widget.width / 1.9);
final size = Size(widget.width, widget.height);
final bgColor = Theme.of(context).colorScheme.onBackground;
final xMin = DateTime(now.year, now.month);
final xMax = DateTime(now.year, now.month + 1);
Expand Down
4 changes: 2 additions & 2 deletions lib/charts/painter/foreground_chart_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class ForegroundChartPainter extends CustomPainter {
}) {
_setTextArea();
shift = textArea * 1.2;
yDiv = 12 * size!.width ~/ 640;
xDiv = 12 * size!.height ~/ 240;
yDiv = 12 * size!.height ~/ 400;
xDiv = 12 * size!.width ~/ 640;
}

void _setTextArea() {
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/metrics/budget_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class BudgetTab extends StatelessWidget {
),
ForecastChart(
width: ThemeHelper.getWidth(context, 4),
height: 200,
indent: indent,
data: [
ForecastData(DataHandler.getAmountGroupedByDate(
Expand Down

0 comments on commit a28a3fd

Please sign in to comment.