Hi all,
I’ve written a class which processes some data and one of it’s functions returns a ‘plotly.graph_objs._figure.Figure’
If i use the output of this class in my app layout as below
html.Div(
className="eight columns div-for-charts bg-grey",
children=[
dcc.Graph(id="pca-details",
figure=pca.plot_graphs()),
dcc.Graph(id="pca-annual",
figure=pca.plot_annual())
This creates the graphs in my dash app as expected but means I can’t create the data dynamically.
However, if I use the class within a callback and return graph_objects.Figure like in the code below, the graphs don’t show any of the data but I also don’t receive any errors
html.Div(
className="eight columns div-for-charts bg-grey",
children=[
dcc.Graph(id="pca-details"),
dcc.Graph(id="pca-annual")
.....
@app.callback(
Output('pca-details', 'figure'),
[Input('name-dropdown', 'value')])
def update_figure(name):
pca = PCA_class('data.csv', 'data2.csv')
pca.create_EWM_(name)
pca.scale_fit_transform_()
return pca.plot_graphs()
Any help as to why the callbacks aren’t workign properly would be much appreciated
Thanks
Grant