Skip to content

Commit

Permalink
Fix for none properties when cloning bokeh glyphs (#4814)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Feb 1, 2021
1 parent 397304b commit 4973c7c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 5 additions & 2 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
TOOL_TYPES, bokeh_version, date_to_integer, decode_bytes, get_tab_title,
glyph_order, py2js_tickformatter, recursive_model_update,
theme_attr_json, cds_column_replace, hold_policy, match_dim_specs,
compute_layout_properties, wrap_formatter, match_ax_type, remove_legend
compute_layout_properties, wrap_formatter, match_ax_type,
prop_is_none, remove_legend
)

try:
Expand Down Expand Up @@ -1249,7 +1250,9 @@ def _update_glyph(self, renderer, properties, mapping, glyph, source, data):
glyph = getattr(renderer, glyph_type+'glyph', None)
if glyph == 'auto':
base_glyph = renderer.glyph
glyph = type(base_glyph)(**base_glyph.properties_with_values())
props = base_glyph.properties_with_values()
glyph = type(base_glyph)(**{k: v for k, v in props.items()
if not prop_is_none(v)})
setattr(renderer, glyph_type+'glyph', glyph)
if not glyph or (not renderer and glyph_type):
continue
Expand Down
9 changes: 9 additions & 0 deletions holoviews/plotting/bokeh/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ def convert_timestamp(timestamp):
return np.datetime64(datetime.replace(tzinfo=None))


def prop_is_none(value):
"""
Checks if property value is None.
"""
return (value is None or
(isinstance(value, dict) and 'value' in value
and value['value'] is None))


def decode_bytes(array):
"""
Decodes an array, list or tuple of bytestrings to avoid python 3
Expand Down

0 comments on commit 4973c7c

Please sign in to comment.