Skip to content

✨ register plotly-resampler #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8df121e
:construction: 1st quick implementation of register plotly-resampler
jvdd Jun 9, 2022
a92a5a4
:sparkles: first draft of `add_traces`
jonasvdd Jun 9, 2022
22a57f3
:see_no_evil:
jonasvdd Jun 9, 2022
96b3bbb
:recycle: cleanup + fix some :bug:s
jvdd Jun 10, 2022
f1cc248
:broom: move utils.py to figure_resampler + add tests
jvdd Jun 10, 2022
6b682cd
:recycle: test figure as dictionary
jvdd Jun 10, 2022
ca8976b
:fire: add automatic google colab ipywidget support
jvdd Jun 11, 2022
6863c54
:crayon:
jonasvdd Jun 11, 2022
75a57be
:see_no_evil:
jonasvdd Jun 11, 2022
52607dc
:muscle: adding the (un)register functions into __init__
jonasvdd Jun 11, 2022
e4fbe7b
:mag: docs + check for fr & fwr
jonasvdd Jun 11, 2022
1d0cbab
:fire: compose behavior v1 :goat:
jonasvdd Jun 11, 2022
1db6486
:hedgehog: removing unused methods
jonasvdd Jun 11, 2022
b9403a1
:olive: first draft of tests
jonasvdd Jun 12, 2022
9639c06
:cat2: 2nd iteration of compose functionality
jonasvdd Jun 12, 2022
3b4476e
:beaver: composability tests :feet:
jonasvdd Jun 12, 2022
3c80a8f
:deer: adjusting some trace template data
jonasvdd Jun 12, 2022
7769376
:construction: fix pandas deprecation warning
jonasvdd Jun 13, 2022
7dc7df6
:bug: fix small bug where we drop the `hf_data`
jonasvdd Jun 13, 2022
b8ecf99
:mag: adding `limit_to_view` and `agg` `no_agg` tests
jonasvdd Jun 13, 2022
12c4e93
:pen: review code
jvdd Jun 14, 2022
bb057cd
:mag: apply review suggestions
jonasvdd Jun 14, 2022
9b95694
Merge branch 'compose_figs' of github.com:predict-idlab/plotly-resamp…
jonasvdd Jun 14, 2022
2b7f2e7
Merge pull request #72 from predict-idlab/compose_figs
jonasvdd Jun 14, 2022
50a2a2b
:sparkles: improve registering implementation
jvdd Jun 15, 2022
7517dfd
:fire: add registering tests
jvdd Jun 15, 2022
22f32ac
:book: updating docs
jonasvdd Jun 16, 2022
6ab5701
:pencil: review
jonasvdd Jun 16, 2022
d5fe2d1
:pencil: review
jonasvdd Jun 16, 2022
59d753c
:goggles: updating docs conf
jonasvdd Jun 16, 2022
392f8aa
:virgo: adding hf_data_copy tests
jonasvdd Jun 16, 2022
59c70ab
Update README.md
jonasvdd Jun 16, 2022
b94dc4a
:curly_loop: updating & improving docs
jonasvdd Jun 17, 2022
4804862
:pen: update readme
jvdd Jun 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions plotly_resampler/figure_resampler/figure_resampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from trace_updater import TraceUpdater

from .figure_resampler_interface import AbstractFigureAggregator
from .utils import is_figure
from ..aggregation import AbstractSeriesAggregator, EfficientLTTB


Expand All @@ -28,7 +29,7 @@ class FigureResampler(AbstractFigureAggregator, go.Figure):

def __init__(
self,
figure: go.Figure = None,
figure: go.Figure | dict = None,
convert_existing_traces: bool = True,
default_n_shown_samples: int = 1000,
default_downsampler: AbstractSeriesAggregator = EfficientLTTB(),
Expand All @@ -39,10 +40,12 @@ def __init__(
show_mean_aggregation_size: bool = True,
verbose: bool = False,
):
if figure is None:
figure = go.Figure()
if not is_figure(figure): # TODO: does this make sense?
figure = go.Figure(figure)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs some profiling before we decide whether this will be done.

I think you should first check whether the object is a FigureAggregator instance, otherwise it will most likely loose the current _hf_data properties

elif isinstance(figure, FigureResampler):
print("passing") # TODO make composable
pass

assert isinstance(figure, go.Figure)
super().__init__(
figure,
convert_existing_traces,
Expand Down
Loading