Hi Guys, im trying to make my dashboard live, but i have some issues.
#get data from a Mysql and load like a dataframe
df = blackbootle.select_dashboard_view().array_from_Mysql()
This is my code:
import dash
import dash_core_components as dcc
import dash_html_components as html
import blackbootle
from dash.dependencies import Input, Output
app = dash.Dash()
def get_value():
df = blackbootle.select_dashboard_view().array_from_Mysql()
return df
print(get_value())
def serve_layout():
return html.Div(children=[
html.H4(children='Dashboard'),
html.Div(id='my-id', children='''Events'''),
dcc.Graph(id='example-graph', animate=True,
figure={'data': [
{'x': get_value().Hora, 'y': get_value().y, 'type': 'line', 'name': 'Mobile'},
{'x': get_value().Hora, 'y': get_value().x, 'type': 'line', 'name': 'Desktop'},
],
'layout': {'title': 'Logins Por hora'}
}
),
dcc.Interval(
id='interval-component',
interval=5 * 1000,
n_intervals=0 # in milliseconds
),
], )
app.layout = serve_layout
@app.callback(
Output('example-graph','figure'),
[Input('interval-component', 'n_intervals')])
def update_graph():
return get_value()
if __name__ == '__main__':
app.run_server(debug=False)
i got this error:
output_value = func(*args, **kwargs) # %% callback invoked %%
TypeError: update_graph() takes 0 positional arguments but 1 was given
127.0.0.1 - - [13/Feb/2020 13:53:33] âPOST /_dash-update-component HTTP/1.1â 500 -
[2020-02-13 13:53:38,444] ERROR in app: Exception on /_dash-update-component [POST]
the dashboard is working in this way, but i want to tranforme him in a live update.
I tryed to adjuste the callback function, but didint work.
Someone has some tips to help me?
Thanks.
static dashboard