Better dashboard! Should fix prst.json
This commit is contained in:
parent
3401b68d6c
commit
7054ec8014
16
bot/main.py
16
bot/main.py
@ -30,7 +30,6 @@ class ChatBot(FW.BotFramework):
|
|||||||
"weather" : self.bot_show_weather,
|
"weather" : self.bot_show_weather,
|
||||||
"google" : self.bot_google_search,
|
"google" : self.bot_google_search,
|
||||||
"events" : self.bot_print_events,
|
"events" : self.bot_print_events,
|
||||||
"emojify" : self.bot_emojify,
|
|
||||||
"wikipedia" : self.bot_show_wikipedia,
|
"wikipedia" : self.bot_show_wikipedia,
|
||||||
"zvv" : self.bot_zvv,
|
"zvv" : self.bot_zvv,
|
||||||
"cronjob" : self.bot_cronjob,
|
"cronjob" : self.bot_cronjob,
|
||||||
@ -153,21 +152,6 @@ class ChatBot(FW.BotFramework):
|
|||||||
return send_string
|
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):
|
def bot_show_help(self, *args):
|
||||||
"""Show a help message.
|
"""Show a help message.
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ class DashBoard():
|
|||||||
|
|
||||||
@self.app.callback(Output('layout-update','children'), Input('interval-component','n_intervals'))
|
@self.app.callback(Output('layout-update','children'), Input('interval-component','n_intervals'))
|
||||||
def update_layout(n):
|
def update_layout(n):
|
||||||
print("REFRESH")
|
|
||||||
kids = [
|
kids = [
|
||||||
self.card_header(),
|
self.card_header(),
|
||||||
dbc.CardColumns([
|
dbc.CardColumns([
|
||||||
@ -91,12 +90,24 @@ class DashBoard():
|
|||||||
|
|
||||||
|
|
||||||
def card_bot_stats(self):
|
def card_bot_stats(self):
|
||||||
xs = self.persistence["bot"]["send_activity"]["hour"]
|
def cleanse_graph(category):
|
||||||
ys = self.persistence["bot"]["send_activity"]["count"]
|
x = self.persistence["bot"][category]["hour"]
|
||||||
xr = self.persistence["bot"]["receive_activity"]["hour"]
|
y = self.persistence["bot"][category]["count"]
|
||||||
yr = self.persistence["bot"]["receive_activity"]["count"]
|
xn = range(x[0], x[-1]+1)
|
||||||
xe = self.persistence["bot"]["execute_activity"]["hour"]
|
yn = []
|
||||||
ye = self.persistence["bot"]["execute_activity"]["count"]
|
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 = go.Figure()
|
||||||
fig.add_trace(go.Scatter(x=xr, y=yr, mode="lines", text="Gelesen", line=dict(width=4)))
|
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_xaxes(showgrid=False)
|
||||||
fig.update_yaxes(showgrid=False)
|
fig.update_yaxes(showgrid=False)
|
||||||
fig.layout.update(
|
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,
|
showlegend=False,
|
||||||
margin=dict(l=0, r=0, t=0, b=0),
|
margin=dict(l=0, r=0, t=0, b=0),
|
||||||
paper_bgcolor='rgba(0,0,0,0)',
|
paper_bgcolor='rgba(0,0,0,0)',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user