Hello,
for the document upload, check dcc.Upload, basically you will add another function to process the file after being uploaded, this function will be called in the Callback function, the result of your processing should be data that will be plotted and displayed for the user.
app.layout = html.Div([
dcc.Graph(id='MyGraph',animate=True),
# Upload component
dcc.Upload(
id='upload-data',
children=html.Div([
'Drag and Drop or ',
html.A('Select Files')
])
])
# function to process your uploaded data
def parse_contents(contents, filename, date):
# processing
@app.callback(Output('MyGraph', 'figure'),
[Input('upload-data', 'contents')],
[State('upload-data', 'filename'),
State('upload-data', 'last_modified')])
def update_output(list_of_contents, list_of_names, list_of_dates):
if list_of_contents is not None:
# Do processing using parse_contents() function
return figure #return graph content to be shown
Check here to get an idea how to link Callback function return with your graph.