Callback interval < 100 doesn't work / slow

#1

Working on a callback to do simple updates to a scatter plot “near” real-time from some dummy data in an array.

It seems like if i decrease the interval < 100 it doesn’t render at all. Even the 100 interval seems very slow and choppy on a new macbook pro.

Is this a resource issue on my machine or is it not intended to stream something that fast?

As a note - I have also tried what was recommended here: https://dash.plot.ly/performance But it didn’t seem to make a difference.

The end goal use case is to read serial data from an IOT device and plot this near real-time using dash. The data points come very quick so i’m not sure if dash can keep up.

#2

I may have already found a decent fix. I didn’t realize i could just pass back a hash with the data and layout from the return call from my callback function. This seemed to make it very fast.

I change from:
return go.Figure(data=[trace], layout=layout)

To:
return {‘data’: [trace], ‘layout’: layout}

#3

Wait so using go.Figure is significantly slower than building the dict yourself? Anyone got any idea how much time go.Figure adds on?

#4

It seems to be slower, yes. Not sure why yet but i will look into the constructor of the Figure to see if that is why or maybe it is creating a new object everytime and just returing a hash of the trace and layout maybe append to the figure object?