Compare commits

...

1 Commits
api ... main

Author SHA1 Message Date
Wojciech Kwolek f8b39f16f2 add average to graph 2021-12-04 10:12:28 +01:00
2 changed files with 5 additions and 0 deletions

View File

@ -58,9 +58,13 @@ def gen_graph_data(numbers):
dots = [absolute_to_percentage_position(
n, scale_base) for n in numbers]
lines = list(zip(dots, dots[1:]))
avg = sum(dots)/len(dots)
print(dots)
print(avg)
return {
"dots": dots,
"lines": lines,
"scale": scale,
"avg": avg,
}

View File

@ -13,6 +13,7 @@
{% for n in scale %}
<line x1="10%" y1="{{ 16.6 * loop.index }}%" x2="96%" y2="{{ 16.6 * loop.index }}%" stroke="#ddd" stroke-width="2px" />
{% endfor %}
<line x1="10%" y1="{{ avg }}%" x2="96%" y2="{{ avg }}%" stroke="#89f393" stroke-width="2px" />
</g>
<g class="legend" style="font-size: 0.9em; text-align:right;">
{% for n in scale | reverse %}