Timing for data creation

Hello,

has anyboy experience about when is the right timinig to create the data for interactive graphs?
I have multiple graphs which can be updatet via inputs.

Since tht input data is quite complex and coming from my sql Workbench, I am currently wondering about the right time to create the data.

Is it better to create the needed data once its requestet via callback? Or calculate everything in the beginning, store it in a dataframe and display once requested.

Thanks and best regards!

if you are only visualizing the data and there are no options for the user to query or alter the dataset, it might be best to compute at the start and store (via dcc.Store). However, if the user can customize the query results it might be better to invoke via callback. It also depends on the user experience…do you want the user to wait for the data calcs or have it immediately available

If it is known which data are needed for a particular app, I would query them (and save them to an appropriate format) before deploying the app. Otherwise, I guess querying data on the demand is the only option.

Thanks for the quick answers!
So just to explain a little more in detail: I am trying to visualize a comparison between different drivetrains for vehicles. All the basic data is stored in MySql Workbench. At the beginning, the different vehicles need to be created and and then methods like weigth or range can be calculated and the results are displayed in the graphs.
So the time consuming part is not really the calculaion of the data for the graph, but the creation of the different vehicles, where all the basic vehicle data is then stored.

Since I want to allow the user to make modifications, for example change the base weight of the car or the capacity of the battery, all these modified vehicles need to be created as well.

I would prefer to calculate all the data upfront and then have a quite quickly responding website.

This is why my plan was to create a huge dataframe in the beginning, where all the different vehicles, different modifications and all the data for the graphs are stored. Then the callbacks just have to filter this dataframe for the right data and can update quite quickly.

Does this make sene or are there better ways to do this?

Again thanks for the answers. I am a mechanical enginnering student, who just got into Python for my final thesis, and sometimes its quite hard to find the best ways by just scanning this forum for hours…:smiley: