Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Do figures for clientside callbacks need to initially be written in Python?

Hey guys,

I’m working on a dashboard that has 20+ indicators that are shown all at once. They are all quite repetitive using a simple subplot with one indicator and one gauge. However the speed of the application is very slow asking for data at the python backend every so often. Hence I’m trying to rewrite the callbacks to be clientside.

From the tutorial it seems straight forward to have a store element updated regularly and then put new data into the figures with js-callbacks. But how about the initial creation of the plot? Can I also write this in Javascript? Maybe with Plotly.JS? Or do I have to use python here?

I’d love to do it in JS, since the initial page load takes 25+ seconds and it would probably be much faster.

Thanks for taking the time to answer this! :slight_smile:

I guess it takes time due to the large amount of data? If so, you could try creating the figures empty (in terms of data) in Python and only add the data in a client side callback.

It’s not really a problem of too much data, since most figures with included data only amount to 45kb. It’s rather the network delay asking the python backend for the figure. However I already figured out that I can just use Plotly.JS instructions to style my graphs in the clientside callback.

Would’ve been helpful to read that in the docs or to have a more extensive example :wink: