plotly-resampler icon indicating copy to clipboard operation
plotly-resampler copied to clipboard

Only Update Visible Traces

Open jayceslesar opened this issue 2 years ago • 6 comments

Ideally closes #21

jayceslesar avatar Jun 19 '22 20:06 jayceslesar

Kind of tricky to test -- was hoping to get some interactivity with some print statements inside of a dash app, but alas adding a print after the continue statement where I added to the if clause gives me nothing

jayceslesar avatar Jun 19 '22 20:06 jayceslesar

I assume this is failing because of the visible="legendonly" in lines 317 and 355 in tests/conftest.py ?

jayceslesar avatar Jun 19 '22 21:06 jayceslesar

Thanks for this contribution @jayceslesar! Your code looks clean :smile:

I'll manually test it more in depth tomorrow! I would advise to add some tests for both the FigureResampler & FigureWidgetResampler (but feel free to let me know if you're not comfortable adding tests - I'll gladly do this myself).

PS: The failing test is because we toggle some traces (making them unvisible) and check whether all traces gets resampled (which since this PR will not be the case anymore :tada:)

jvdd avatar Jun 19 '22 21:06 jvdd

Codecov Report

Merging #78 (9828a07) into main (f25cc4e) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #78   +/-   ##
=======================================
  Coverage   98.11%   98.11%           
=======================================
  Files          10       10           
  Lines         743      743           
=======================================
  Hits          729      729           
  Misses         14       14           
Impacted Files Coverage Δ
...ler/figure_resampler/figure_resampler_interface.py 99.70% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f25cc4e...9828a07. Read the comment docs.

codecov-commenter avatar Jun 19 '22 21:06 codecov-commenter

Hey @jayceslesar

I experimented today a little bit with your code and found out that it does not work as desired. Our desired behavior is that after toggling traces off in the front-end (i.e., making them invisible), they should not be resampled until they are toggled on again (i.e., making them again visible).

Your implementation does not result in this desired behavior as we have no (currently) access in the back-end to the front-end state. I think fixing this is not really convenient...

(perhaps @jonasvdd could also chime in with his opinion)

jvdd avatar Jun 20 '22 18:06 jvdd

Your implementation does not result in this desired behavior as we have no (currently) access in the back-end to the front-end state. I think fixing this is not really convenient...

I wonder what the path forward there is, guess I would need more understanding of where the difference between the back end and the front end state exists

jayceslesar avatar Jun 23 '22 00:06 jayceslesar

@jayceslesar,

I created a first implementation on this branch https://github.com/predict-idlab/trace-updater/tree/update_visible of trace_updater. This is a rather naive implementation, as all data still gets resampled at the same time in the back-end.

Will give a more elaborate update sometime later.

jonasvdd avatar Dec 03 '22 20:12 jonasvdd

@jayceslesar, @jvdd, If you are all okay with this; I will close this (legacy) PR, and we will handle this in a future PR! A thesis student of ours (with some help of us) managed to create this functionality. Ideally, this will be added this summer to plotly-resampler! 🔥

jonasvdd avatar May 05 '23 08:05 jonasvdd

Closing is fine for me! @jonasvdd @jayceslesar

jvdd avatar May 07 '23 09:05 jvdd

Okay, will close it!

jonasvdd avatar May 07 '23 10:05 jonasvdd