A very similar quersion was already asked 2016 and is couldn’t be solved properly and I wonder whether the possibilities in solving have changed so far. Researching on this for a day now didn’t return anything useful.
I quote @aburato, who uses only plotly.js, while I am using dash:
My use case is: I need to display a scatter plot by querying a hufge data set on a server, like “give me all the data between 1st jan 2015 and 1st jan 2016”. This data is stored at a very high “density”, say 1 value per minute. This means that the query mentioned before would yield a HUGE amount of points (circa 550.000), which I do not want, because my chart width is, say, 1000 pixel, so to maintain readability I need the server to SAMPLE the original data and give me, say, a point for each 5 pixels (this means 200 points form the original 500.000+ )
Long story short I need to be able to know the actual plot area width so that i can compute the number of points which can fit on the screen, and query the server accordingly.
The only way I can think of is inspecting the DOM and retrieving the svg plot area width, but I’d prefer something less “hacky”
Most importantly, when creating a figure for
The way of executing a js callback as soon as an empty figure is loaded, then get dimensions and then calling the python callback on an ‘data exchange’ div is a callback loop.
Does someone have an idea on that?