I’m struggling with this concept. I have a scatter graph which is fed data, and that data is filtered and manipulated by 10 radio button inputs. The filtering is quite complex, a lot of Pandas and dataframes and sql, but it works great.
Now, as well as outputting to my scatter graph, I need to output this manipulated data somewhere else (to a table, or a div, or whatever) but I can’t work out how. Dash can do multiple outputs, but only (to my knowledge!) based on specific inputs. The input can’t be a variable or dataframe/source.
Should I be dumping my data to a global variable, and then use that as an input in another callback? Or am I going about this the wrong way?
And make sure to write your callbacks appropriately.
Is that what you mean?
*Sorry about not writing I proper example I hope it’s understandable at least.
** I’m not sure this is the best practice, but it’s what I’ve been doing without experiencing performance issues
Use a hidden DIV to output your manipulated data as a JSON dump & then use that data as an Input for further manipulations in other callbacks with JSON loads.
Thanks both. I ended up using the first example in the link @raghunath posted; that example from @chriddyp is really useful. It still doesn’t seem right to call the same function twice to get identical data, but am new to Flask and reactive coding etc, so am happy that it’s working.
Hello,
I am doing this for a sql based get_data. Which means I am hitting the database multiple times - Global variables is not an options, as it doesnt refresh with page reload.
Would caching the results of your callback help? This means that repeated callbacks with the same signature won’t cause additional database hits.
See https://plot.ly/dash/performance.