From 4b7f2662b83887fa55fd0e52f9aa760c8df207e2 Mon Sep 17 00:00:00 2001 From: Konstantin Koslowski Date: Mon, 11 Nov 2019 10:25:32 +0100 Subject: [PATCH] homecontrol-dash: minor changes, update name, some formatting --- homecontrol-dash.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/homecontrol-dash.py b/homecontrol-dash.py index 72b47eb..8681a1a 100755 --- a/homecontrol-dash.py +++ b/homecontrol-dash.py @@ -12,16 +12,17 @@ x = [1] y = [2] external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] +meta_tags=[{"name": "viewport", "content": "width=device-width, initial-scale=1"}] -app = dash.Dash(__name__, external_stylesheets=external_stylesheets) +app = dash.Dash(__name__, external_stylesheets=external_stylesheets, meta_tags=meta_tags) available_sensors = ["undefined"] app.layout = html.Div(children=[ - html.H1(children='homecontrol-dash'), + html.H1(children='dashboard.ykonni.de'), html.Div(children=''' - homecontrol-dash: visualize data + visualize sensor data '''), dcc.Graph( id='example-graph', @@ -66,7 +67,7 @@ def update_graph(n_clicks, sensorId): content = res.json() v = content[sensorId]["values"] sensorType = content[sensorId]["sensorType"] - x = [time.strftime("%m%d-%H%M%S", time.localtime(float(v[i]["ts"]))) for i in range(len(v))] + x = [time.strftime("%m%d-%H%M", time.localtime(float(v[i]["ts"]))) for i in range(len(v))] y = [v[i]["value"] for i in range(len(v))] else: sensorType = sensorId @@ -75,15 +76,14 @@ def update_graph(n_clicks, sensorId): return { 'data': [ - {'x': x, 'y': y, 'mode': 'markers', 'name': "%s (%s)" % (sensorType, - sensorId)} + {'x': x, 'y': y, 'mode': 'markers', 'name': "%s" % (sensorType)} ], 'layout': { - 'title': 'Data for sensor: %s (%s)' % (sensorType, sensorId) + 'title': 'Data for sensor: %s' % (sensorType) } } if __name__ == '__main__': - app.run_server(debug=True) + app.run_server(port=8081,debug=True)