From ee0402b9988763df4db8da42973aadb2a87c229e Mon Sep 17 00:00:00 2001 From: Lukas Metzger Date: Sun, 24 May 2020 18:04:26 +0200 Subject: Added automatic height for cpumodel and systemmodel --- pages/machines.py | 8 ++++---- 1 file 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 -- cgit v1.2.3-55-g7522