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

Further Bokeh 2.3 compatibility fixes #4809

Merged
merged 2 commits into from
Jan 31, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
32 changes: 21 additions & 11 deletions holoviews/plotting/bokeh/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@
)
from ..links import Link, RectanglesTableLink, DataLink, RangeToolLink, SelectionLink, VertexTableLink
from ..plot import GenericElementPlot, GenericOverlayPlot
from .util import convert_timestamp
from .util import bokeh_version, convert_timestamp

if bokeh_version >= '2.3.0':
CUSTOM_TOOLTIP = 'description'
else:
CUSTOM_TOOLTIP = 'custom_tooltip'



class MessageCallback(object):
Expand Down Expand Up @@ -1272,13 +1278,15 @@ def initialize(self, plot_id=None):
if stream.num_objects:
kwargs['num_objects'] = stream.num_objects
if stream.tooltip:
kwargs['custom_tooltip'] = stream.tooltip
kwargs[CUSTOM_TOOLTIP] = stream.tooltip
if stream.styles:
self._create_style_callback(cds, glyph, 'x')
if stream.empty_value is not None:
kwargs['empty_value'] = stream.empty_value
point_tool = PointDrawTool(
add=all(s.add for s in self.streams),
drag=all(s.drag for s in self.streams),
empty_value=stream.empty_value, renderers=renderers, **kwargs)
renderers=renderers, **kwargs)
self.plot.state.tools.append(point_tool)
self._update_cds_vdims(cds.data)
# Add any value dimensions not already in the CDS data
Expand All @@ -1302,7 +1310,7 @@ def initialize(self, plot_id=None):
renderers = [renderer]
kwargs = {}
if stream.tooltip:
kwargs['custom_tooltip'] = stream.tooltip
kwargs[CUSTOM_TOOLTIP] = stream.tooltip
point_tool = PointDrawTool(
add=False, drag=True, renderers=renderers, **kwargs
)
Expand Down Expand Up @@ -1349,10 +1357,11 @@ def initialize(self, plot_id=None):
if stream.styles:
self._create_style_callback(cds, glyph, 'xs')
if stream.tooltip:
kwargs['custom_tooltip'] = stream.tooltip
kwargs[CUSTOM_TOOLTIP] = stream.tooltip
if stream.empty_value is not None:
kwargs['empty_value'] = stream.empty_value
poly_tool = PolyDrawTool(
drag=all(s.drag for s in self.streams),
empty_value=stream.empty_value, renderers=renderers,
drag=all(s.drag for s in self.streams), renderers=renderers,
**kwargs
)
plot.state.tools.append(poly_tool)
Expand Down Expand Up @@ -1396,9 +1405,10 @@ def initialize(self, plot_id=None):
self._create_style_callback(cds, glyph, 'xs')
kwargs = {}
if stream.tooltip:
kwargs['custom_tooltip'] = stream.tooltip
kwargs[CUSTOM_TOOLTIP] = stream.tooltip
if stream.empty_value is not None:
kwargs['empty_value'] = stream.empty_value
poly_tool = FreehandDrawTool(
empty_value=stream.empty_value,
num_objects=stream.num_objects,
renderers=[plot.handles['glyph_renderer']],
**kwargs
Expand Down Expand Up @@ -1450,7 +1460,7 @@ def initialize(self, plot_id=None):
if stream.num_objects:
kwargs['num_objects'] = stream.num_objects
if stream.tooltip:
kwargs['custom_tooltip'] = stream.tooltip
kwargs[CUSTOM_TOOLTIP] = stream.tooltip

renderer = self.plot.handles['glyph_renderer']
if isinstance(self.plot, PathPlot):
Expand Down Expand Up @@ -1496,7 +1506,7 @@ def initialize(self, plot_id=None):
stream = self.streams[0]
kwargs = {}
if stream.tooltip:
kwargs['custom_tooltip'] = stream.tooltip
kwargs[CUSTOM_TOOLTIP] = stream.tooltip
if vertex_tool is None:
vertex_style = dict({'size': 10}, **stream.vertex_style)
r1 = plot.state.scatter([], [], **vertex_style)
Expand Down
3 changes: 2 additions & 1 deletion holoviews/plotting/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def get_extents(self, element, ranges, range_type='combined'):
if len(vdims) > 1:
new_range = {}
for r in ranges[vdim]:
new_range[r] = util.max_range([ranges[vd.name][r] for vd in vdims])
if r != 'values':
new_range[r] = util.max_range([ranges[vd.name][r] for vd in vdims])
ranges[vdim] = new_range
else:
s0, s1 = ranges[vdim]['soft']
Expand Down