From d4764515aff474c8acb79aabf1c9ecfccb05f830 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Thu, 29 Oct 2020 12:27:08 +0100 Subject: [PATCH] started working on a website dashboard --- clock/main.py | 2 +- dashboard/__init__.py | 1 + dashboard/main.py | 0 dashboard_wrapper.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 dashboard/__init__.py create mode 100644 dashboard/main.py create mode 100644 dashboard_wrapper.py diff --git a/clock/main.py b/clock/main.py index 2375095..905f933 100644 --- a/clock/main.py +++ b/clock/main.py @@ -14,7 +14,7 @@ import persistence.rw class ClockFace(object): """Actual functions one might need for a clock""" - def __init__(self, text_speed=15): + def __init__(self, text_speed=18): self.IO = led.OutputHandler(32,16) self.tspeed = text_speed diff --git a/dashboard/__init__.py b/dashboard/__init__.py new file mode 100644 index 0000000..dcf2c80 --- /dev/null +++ b/dashboard/__init__.py @@ -0,0 +1 @@ +# Placeholder diff --git a/dashboard/main.py b/dashboard/main.py new file mode 100644 index 0000000..e69de29 diff --git a/dashboard_wrapper.py b/dashboard_wrapper.py new file mode 100644 index 0000000..caf98c0 --- /dev/null +++ b/dashboard_wrapper.py @@ -0,0 +1,42 @@ +import dash +from flask import Flask +import dash_core_components as dcc +import dash_html_components as html +import plotly.graph_objs as go +import numpy as np + +external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] + +server = Flask(__name__) +app = dash.Dash(__name__, server=server, external_stylesheets = external_stylesheets) + +np.random.seed(101) +random_x = np.linspace(1,5,20) +random_y = np.exp(random_x) + + +app.layout = html.Div(children = [ + html.H1("Hello wolrd!"), + dcc.Graph( + id="scatter", + figure = { + "data" : [ + go.Scatter( + x = random_x, + y = random_y, + mode="markers" + ) + ], + "layout" : go.Layout( + title="This is a test", + xaxis={"title" : "x"}, + yaxis={"title" : "y"} + ) + } + ), + + ]) + + +if __name__ == "__main__": + app.run_server(host="0.0.0.0")