From 7054ec8014b82238ebc37385cb39b62148cc3679 Mon Sep 17 00:00:00 2001
From: Remy Moll <mollator2@gmail.com>
Date: Sun, 17 Jan 2021 23:56:32 +0100
Subject: [PATCH] Better dashboard! Should fix prst.json

---
 bot/main.py       | 16 ----------------
 dashboard/main.py | 36 +++++++++++++++++++++++++++++-------
 2 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/bot/main.py b/bot/main.py
index ae4980a..891a212 100644
--- a/bot/main.py
+++ b/bot/main.py
@@ -30,7 +30,6 @@ class ChatBot(FW.BotFramework):
             "weather" : self.bot_show_weather,
             "google" : self.bot_google_search,
             "events" : self.bot_print_events,
-            "emojify" : self.bot_emojify,
             "wikipedia" : self.bot_show_wikipedia,
             "zvv" : self.bot_zvv,
             "cronjob" : self.bot_cronjob,
@@ -153,21 +152,6 @@ class ChatBot(FW.BotFramework):
         return send_string
 
 
-    def bot_emojify(self, *args):
-        """Converts a string to emojis"""
-
-        if len(args) < 2:
-            return "Please send a separator as the first argument, and the text afterwards.\nExample:\n/emojify :heart: Example text"
-
-        sep = args[0]
-        string_emoji = ""
-        for word in args[1:]:
-            out_string = self.emojify_word(word)
-            string_emoji += out_string + sep
-
-        return string_emoji
-
-
     def bot_show_help(self, *args):
         """Show a help message.
         
diff --git a/dashboard/main.py b/dashboard/main.py
index 09677d6..361512d 100644
--- a/dashboard/main.py
+++ b/dashboard/main.py
@@ -39,7 +39,6 @@ class DashBoard():
 
         @self.app.callback(Output('layout-update','children'), Input('interval-component','n_intervals'))
         def update_layout(n):
-            print("REFRESH")
             kids = [
                 self.card_header(),
                 dbc.CardColumns([
@@ -91,12 +90,24 @@ class DashBoard():
 
 
     def card_bot_stats(self):
-        xs = self.persistence["bot"]["send_activity"]["hour"]
-        ys = self.persistence["bot"]["send_activity"]["count"]
-        xr = self.persistence["bot"]["receive_activity"]["hour"]
-        yr = self.persistence["bot"]["receive_activity"]["count"]
-        xe = self.persistence["bot"]["execute_activity"]["hour"]
-        ye = self.persistence["bot"]["execute_activity"]["count"]
+        def cleanse_graph(category):
+            x = self.persistence["bot"][category]["hour"]
+            y = self.persistence["bot"][category]["count"]
+            xn = range(x[0], x[-1]+1)
+            yn = []
+            count = 0
+            for x_i in xn:
+                if x_i in x:
+                    yn.append(y[count])
+                    count += 1
+                else:
+                    yn.append(0)
+            xn = [i - int(x[0]) for i in xn]
+            return xn, yn
+
+        xs, ys = cleanse_graph("send_activity")
+        xr, yr = cleanse_graph("receive_activity")
+        xe, ye = cleanse_graph("execute_activity")
         
         fig = go.Figure()
         fig.add_trace(go.Scatter(x=xr, y=yr, mode="lines", text="Gelesen", line=dict(width=4)))
@@ -106,6 +117,17 @@ class DashBoard():
         fig.update_xaxes(showgrid=False)
         fig.update_yaxes(showgrid=False)
         fig.layout.update(
+            xaxis = {
+                'showgrid': False, # thin lines in the background
+                'zeroline': False, # thick line at x=0
+                'visible': False,  # numbers below
+            }, # the same for yaxis
+            yaxis = {
+                'showgrid': False, # thin lines in the background
+                'zeroline': False, # thick line at x=0
+                'visible': False,  # numbers below
+            }, # the same for yaxis
+
             showlegend=False,
             margin=dict(l=0, r=0, t=0, b=0),
             paper_bgcolor='rgba(0,0,0,0)',