summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Metzger2020-05-24 18:04:26 +0200
committerLukas Metzger2020-05-24 18:04:26 +0200
commitee0402b9988763df4db8da42973aadb2a87c229e (patch)
tree4160940814e2eb155c47bdc5eaab35ea9d7b8de7
parentAdd more expressive headings (diff)
downloadbwlp-statistics-ee0402b9988763df4db8da42973aadb2a87c229e.tar.gz
bwlp-statistics-ee0402b9988763df4db8da42973aadb2a87c229e.tar.xz
bwlp-statistics-ee0402b9988763df4db8da42973aadb2a87c229e.zip
Added automatic height for cpumodel and systemmodel
-rw-r--r--pages/machines.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pages/machines.py b/pages/machines.py
index 62bbfc0..5ec8956 100644
--- a/pages/machines.py
+++ b/pages/machines.py
@@ -108,7 +108,7 @@ def make_graph_location(days, date, satellites):
Input('machines-date', 'date'),
Input('machines-satellites', 'value')])
def make_graph_cpumodel(days, date, satellites):
- return make_graph(days, date, satellites, 'cpumodel', 'CPU', typ='bar', height=600)
+ return make_graph(days, date, satellites, 'cpumodel', 'CPU', typ='bar')
@app.callback(Output('machines-graph-realcores', 'figure'),
[Input('machines-days', 'value'),
@@ -129,7 +129,7 @@ def make_graph_ram(days, date, satellites):
Input('machines-date', 'date'),
Input('machines-satellites', 'value')])
def make_graph_systemmodel(days, date, satellites):
- return make_graph(days, date, satellites, 'systemmodel', 'System Model', typ='bar', height=600)
+ return make_graph(days, date, satellites, 'systemmodel', 'System Model', typ='bar')
@app.callback(Output('machines-graph-kvmstate', 'figure'),
[Input('machines-days', 'value'),
@@ -139,7 +139,7 @@ def make_graph_kvmstate(days, date, satellites):
return make_graph(days, date, satellites, 'kvmstate', 'KVM State')
-def make_graph(days, date, satellites, prop, title, unit='', typ='pie', height=450):
+def make_graph(days, date, satellites, prop, title, unit='', typ='pie'):
dbcon = db.getConnection()
cursor = dbcon.cursor()
@@ -181,7 +181,7 @@ def make_graph(days, date, satellites, prop, title, unit='', typ='pie', height=4
))
figure.update_layout(
title_text = title,
- height = height,
+ height = 450 if typ == 'pie' else max(20 * len(data) + 200,300),
yaxis_automargin=True
)
return figure