Skip to content

Commit

Permalink
Fixed Path hover issues
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Nov 25, 2018
1 parent 52b4e6c commit aaf5135
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions holoviews/plotting/bokeh/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_data(self, element, ranges, style):
(isinstance(v, util.basestring) and v in element) or isinstance(v, dim))
inds = (1, 0) if self.invert_axes else (0, 1)
mapping = dict(self._mapping)
if not cdim and not style_mapping:
if not cdim and not style_mapping and 'hover' not in self.handles:
if self.static_source:
data = {}
else:
Expand All @@ -75,10 +75,10 @@ def get_data(self, element, ranges, style):
data = dict(xs=xs, ys=ys)
return data, mapping, style

vals = {}
hover = 'hover' in self.handles
vals = defaultdict(list)
if hover:
vals = {util.dimension_sanitizer(vd.name): [] for vd in element.vdims}
vals.update({util.dimension_sanitizer(vd.name): [] for vd in element.vdims})
if cdim:
dim_name = util.dimension_sanitizer(cdim.name)
cmapper = self._get_colormapper(cdim, element, ranges, style)
Expand All @@ -89,21 +89,20 @@ def get_data(self, element, ranges, style):
for path in element.split():
if cdim:
cvals = path.dimension_values(cdim)
vals[dim_name] = cvals[:-1]
vals[dim_name].append(cvals[:-1])
array = path.array(path.kdims)
alen = len(array)
paths = [array[s1:s2+1] for (s1, s2) in zip(range(alen-1), range(1, alen+1))]
paths += [array[s1:s2+1] for (s1, s2) in zip(range(alen-1), range(1, alen+1))]
if not hover:
continue
for vd in element.vdims:
values = path.dimension_values(vd)[:-1]
vd_name = util.dimension_sanitizer(vd.name)
vals[vd_name] = values
vals[vd_name].append(values)
if values.dtype.kind == 'M':
vals[vd_name+'_dt_strings'] = [vd.pprint_value(v) for v in values]

vals[vd_name+'_dt_strings'].append(vd.pprint_value(v) for v in values)
xs, ys = ([path[:, idx] for path in paths] for idx in inds)
data = dict(xs=xs, ys=ys, **{d: np.asarray(vs) for d, vs in vals.items()})
data = dict(xs=xs, ys=ys, **{d: np.concatenate(vs) for d, vs in vals.items()})
self._get_hover_data(data, element)
return data, mapping, style

Expand Down

0 comments on commit aaf5135

Please sign in to comment.