From ee4e6b7ceb3a1a2edfe10644a42ffb08570c2f42 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sat, 30 Dec 2023 10:10:53 +0100 Subject: [PATCH] Improve history plot with empty segments --- nummi/history/templates/history/plot.html | 90 ++++++++++++----------- nummi/main/static/main/css/plot.css | 3 + nummi/main/static/main/css/table.css | 2 +- 3 files changed, 50 insertions(+), 45 deletions(-) diff --git a/nummi/history/templates/history/plot.html b/nummi/history/templates/history/plot.html index e8d7aa0..19d5060 100644 --- a/nummi/history/templates/history/plot.html +++ b/nummi/history/templates/history/plot.html @@ -21,52 +21,54 @@ {% spaceless %} {% for y in history.years reversed %} {% for date in y.d reversed %} - {% if date %} - - - - - - {% if date.has_transactions %} - {% if account %} - {{ date.month|date:"Y-m" }} - {% elif category %} - {{ date.month|date:"Y-m" }} + {% ifchanged %} + {% if date %} + + + + + + {% if date.has_transactions %} + {% if account %} + {{ date.month|date:"Y-m" }} + {% elif category %} + {{ date.month|date:"Y-m" }} + {% else %} + {{ date.month|date:"Y-m" }} + {% endif %} {% else %} - {{ date.month|date:"Y-m" }} + {{ date.month|date:"Y-m" }} {% endif %} - {% else %} - {{ date.month|date:"Y-m" }} - {% endif %} - - {{ date.sum_m|pmrvalue }} - - {% if date.sum_m %} -
- {% endif %} - {% if date.sum < 0 %} -
- {{ date.sum|pmrvalue }} -
- {% endif %} - - - {% if date.sum_p %} -
- {% endif %} - {% if date.sum > 0 %} -
- {{ date.sum|pmrvalue }} -
- {% endif %} - - {{ date.sum_p|pmrvalue }} - - {% else %} - - - - {% endif %} + + {{ date.sum_m|pmrvalue }} + + {% if date.sum_m %} +
+ {% endif %} + {% if date.sum < 0 %} +
+ {{ date.sum|pmrvalue }} +
+ {% endif %} + + + {% if date.sum_p %} +
+ {% endif %} + {% if date.sum > 0 %} +
+ {{ date.sum|pmrvalue }} +
+ {% endif %} + + {{ date.sum_p|pmrvalue }} + + {% else %} + + + + {% endif %} + {% endifchanged %} {% endfor %} {% endfor %} {% endspaceless %} diff --git a/nummi/main/static/main/css/plot.css b/nummi/main/static/main/css/plot.css index 8aaf8d4..1f025d2 100644 --- a/nummi/main/static/main/css/plot.css +++ b/nummi/main/static/main/css/plot.css @@ -66,6 +66,9 @@ table.full-width col.bar { .plot tr.empty { height: 0.5rem; } +.plot tr.even { + background: #eeeeff; +} @media (width < 720px) { .plot .bar { diff --git a/nummi/main/static/main/css/table.css b/nummi/main/static/main/css/table.css index 9aaeace..133fb68 100644 --- a/nummi/main/static/main/css/table.css +++ b/nummi/main/static/main/css/table.css @@ -25,7 +25,7 @@ tr { height: 2rem; line-height: 2rem; } -tbody tr:nth-of-type(even) { +.table tbody tr:nth-of-type(even) { background: #eeeeff; } td,