So I have following problem.
I would like to use figure_factory tables in website hosted with Dash. (The look very modern out of the box and I don’t want to play with styles). I would also like to update table data every 5 seconds. The code which I wrote is listed bellow.
In theory it works, but unfortunately, after every update callback , table losses colours. (Weird behaviour is shown in the video). After I click on “rescale button”, colours appears back, but only until next data update.
Code
import plotly.graph_objs as go
import plotly.figure_factory as ff
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
app = dash.Dash()
app.layout = html.Div(children=[
dcc.Graph(
id='live-sat__graph',
figure=go.Figure(
ff.create_table([[1, 1], [2, 2]])
),
animate=True
),
dcc.Interval(
id='live-sat__interval-component',
interval=5*1000, # in milliseconds
n_intervals=0
)
])
@app.callback(Output('live-sat__graph', 'figure'),
[Input('live-sat__interval-component', 'n_intervals')])
def update_live_sat_table(n):
return go.Figure(
ff.create_table(
[[1+n, 1+n], [2+n, 2+n]]
)
)
if __name__ == '__main__':
app.run_server(debug=True)
Have you got any idea, how can i solve this problem?