Update graphics

This commit is contained in:
Edgar P. Burkhart 2022-05-24 17:09:16 +02:00
parent d9abdf798f
commit 73ce1a298e
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
4 changed files with 110 additions and 63 deletions

View file

@ -6,6 +6,7 @@
{{ block.super }}
<link rel="stylesheet" href="{% static 'main/css/form.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'main/css/table.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'main/css/chart.css' %}" type="text/css" />
{% endblock %}
{% block body %}
@ -32,7 +33,54 @@
</form>
<h2>Plot</h2>
<img src="{% url 'snapshot_graph' snapshot.id %}" />
<div class="chart">
{% for cat in categories %}
<div class="name">
{% if cat.category %}
<i class="fa fa-{{ cat.category__icon }}"></i>
<a href="{% url 'category' cat.category %}">
{{ cat.category__name }}
</a>
{% else %}
<i class="fa fa-wallet"></i></i>
{% endif %}
</div>
<div class="value left">
{% pmvalue cat.sum_m %}
</div>
<div class="left">
<div
class="bar bar_m"
style="width:{% widthratio cat.sum_m cat_lim_m 100 %}%"
title="{{ cat.sum_m }}">
</div>
{% if cat.sum < 0 %}
<div
class="bar tot"
style="width:{% widthratio cat.sum cat_lim_m 100 %}%"
title="{{ cat.sum }}">
</div>
{% endif %}
</div>
<div class="right">
<div
class="bar bar_p"
style="width:{% widthratio cat.sum_p cat_lim 100 %}%"
title="{{ cat.sum_p }}">
</div>
{% if cat.sum >= 0 %}
<div
class="bar tot"
style="width:{% widthratio cat.sum cat_lim 100 %}%"
title="{{ cat.sum }}">
</div>
{% endif %}
</div>
<div class="value right">
{% pmvalue cat.sum_p %}
</div>
{% endfor %}
</div>
{% if snapshot.transactions %}
<h2>Transactions ({% pmvalue sum %} / {% pmvalue snapshot.diff %})</h2>