Fix broken negative bars when total is negative (fixes #10)

This commit is contained in:
Edgar P. Burkhart 2023-05-04 22:02:22 +02:00
parent 02bd1853d5
commit 3c1e4ac45d
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -23,7 +23,7 @@ def category_plot(transactions, **kwargs):
"categories": categories,
}
| categories.aggregate(
max=Greatest(models.Sum("sum_m"), models.Sum("sum_p")),
max=Greatest(-models.Sum("sum_m"), models.Sum("sum_p")),
total_m=models.Sum("sum_m"),
total_p=models.Sum("sum_p"),
total=models.Sum("sum"),