1
1

completely remove coloring of graph bars

This commit is contained in:
2020-03-09 16:43:46 +01:00
parent 1675f5a545
commit be4bb962ea
3 changed files with 8 additions and 56 deletions

View File

@@ -35,31 +35,17 @@ class DailyStat:
self.balance_amount = balance_amount
self.actual_transactions = actual_transactions
self.resulting_amount = resulting_amount
self.percentage = 0
self.color_class = ""
self.opacity_class = ""
self.highlighted = False
self.percentage = 40
def __str__(self):
return f"DailyStat({self.date}, {self.balance_amount}, " \
f"{len(self.actual_transactions)} a. transactions, {self.resulting_amount})"
def generate_graph_bar_attributes(self, amount_scale, today):
self.highlighted = self.date == today
if self.resulting_amount is not None:
self.percentage = int((self.resulting_amount / amount_scale) * 100)
if self.percentage >= 60:
self.color_class = "green"
elif self.percentage >= 45:
self.color_class = "olive"
elif self.percentage >= 30:
self.color_class = "yellow"
elif self.percentage >= 15:
self.color_class = "orange"
else:
self.color_class = "red"
if self.date == today:
self.opacity_class = "highlighted"
elif self.balance_amount or self.actual_transactions:
self.opacity_class = "strong"
class Statistics:

View File

@@ -177,49 +177,16 @@ tr:hover {
min-height: 10px;
margin-right: 1px;
border-radius: 2px;
opacity: 60%;
background-color: #FFCC99;
z-index: 10;
}
.graph-bar.highlighted {
opacity: 100%;
border: 1px solid #FFFCF9;
}
.graph-bar.strong {
opacity: 80%;
}
.graph-bar.weak {
height: 40%;
opacity: 40%;
}
.graph-bar.green {
background-color: #55DD22;
}
.graph-bar.olive {
background-color: #99CC33;
}
.graph-bar.yellow {
background-color: #CCCC33;
}
.graph-bar.orange {
background-color: #CC9933;
}
.graph-bar.red {
background-color: #DD5522;
}
.graph-bar.grey {
background-color: #777766;
}
.graph-bar:hover {
background-color: #FFFCF9;
box-shadow: #FFFCF9 0 0 12px;
opacity: 100%;
z-index: 11;
}

View File

@@ -15,13 +15,12 @@
<div id="graph">
{% for stat in daily_stats %}
{% if stat.percentage is None %}
<div class="graph-bar weak grey"
<div class="graph-bar"
onmouseover="showGraphBarDate('{{ stat.date|date:"d.m.y" }}')"
onmouseleave="clearGraphBarDate()">
</div>
{% else %}
<div class="graph-bar {{ stat.opacity_class }} {{ stat.color_class }}"
style="height: {{ stat.percentage }}%"
<div class="graph-bar" style="height: {{ stat.percentage }}%;"
onmouseover="showGraphBarDate('{{ stat.date|date:"d.m.y" }}')"
onmouseleave="clearGraphBarDate()">
</div>