Describe the bug :crayon:
Updating a plot with the layout.uirevision property set resamples to the entire dataset, and not the zoomed view.
Reproducing the bug :mag:
This can be reproduced in 02_minimal_cache.py by adding the following line to plot_graph just before the figure is returned:
fig.layout.uirevision = 'test'
Zooming into a specific section of the plot resamples as expected:
But after pressing the 'plot chart' button again, the plot is not resampled properly:
Expected behavior :wrench:
The resampling should take zoom preserved by uirevision into account, so the resampling adjusts after an update.
Environment information: (please complete the following information)
OS: Windows 10
Python environment:
Python version: 3.11.4
plotly-resampler environment: Dash web app in Edge, also tested in Chrome and in a Jupyter Notebook
plotly-resampler version: 0.9.1
Additional context
It seems that there is no relayout event triggered after a plot update with uirevision, so construct_update_data never executes. I tried changing the update_fig callback to address this (changing the store state -> input), but the relayoutData property is reset after an update so this doesn't work either.
As well, the newest version of dash_extensions has changed ServersideOutput -> Serverside, and it is now a wrapper around the returned value instead of in the callback definition. I have updated this for my example, I can also make a PR if that would be helpful 😄
Describe the bug :crayon: Updating a plot with the layout.uirevision property set resamples to the entire dataset, and not the zoomed view.
Reproducing the bug :mag: This can be reproduced in 02_minimal_cache.py by adding the following line to plot_graph just before the figure is returned:
fig.layout.uirevision = 'test'
Here's the full code with edits: https://pastebin.com/5nb6UXJA
Zooming into a specific section of the plot resamples as expected:
But after pressing the 'plot chart' button again, the plot is not resampled properly:
Expected behavior :wrench: The resampling should take zoom preserved by
uirevision
into account, so the resampling adjusts after an update.Environment information: (please complete the following information)
Additional context It seems that there is no relayout event triggered after a plot update with
uirevision
, soconstruct_update_data
never executes. I tried changing the update_fig callback to address this (changing the store state -> input), but therelayoutData
property is reset after an update so this doesn't work either.As well, the newest version of
dash_extensions
has changedServersideOutput
->Serverside
, and it is now a wrapper around the returned value instead of in the callback definition. I have updated this for my example, I can also make a PR if that would be helpful 😄