Skip to content
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

Hold rendering until a plot has been fully updated #6265

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
3 changes: 3 additions & 0 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
get_ticker_axis_props,
glyph_order,
hold_policy,
hold_render,
match_ax_type,
match_dim_specs,
match_yaxis_type_to_range,
Expand Down Expand Up @@ -2228,6 +2229,7 @@ def _reset_ranges(self):
if isinstance(s, RangeXY) and not s._triggering:
s.reset()

@hold_render
def update_frame(self, key, ranges=None, plot=None, element=None):
"""
Updates an existing plot with data corresponding
Expand Down Expand Up @@ -3379,6 +3381,7 @@ def initialize_plot(self, ranges=None, plot=None, plots=None):

return self.handles['plot']

@hold_render
def update_frame(self, key, ranges=None, element=None):
"""
Update the internal state of the Plot to represent the given
Expand Down
15 changes: 15 additions & 0 deletions holoviews/plotting/bokeh/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,21 @@ def wrapper(self, *args, **kwargs):
return wrapper


def hold_render(f):
"""
Decorator that will hold render on a Bokeh ElementPlot until after
the method has been called.
"""
def wrapper(self, *args, **kwargs):
hold = self.state.hold_render
hoxbro marked this conversation as resolved.
Show resolved Hide resolved
self.state.hold_render = True
try:
f(self, *args, **kwargs)
philippjfr marked this conversation as resolved.
Show resolved Hide resolved
finally:
self.state.hold_render = hold
philippjfr marked this conversation as resolved.
Show resolved Hide resolved
return wrapper
philippjfr marked this conversation as resolved.
Show resolved Hide resolved


def categorize_array(array, dim):
"""
Uses a Dimension instance to convert an array of values to categorical
Expand Down
Loading