Skip to content

Commit

Permalink
Fix for BoxEdit stream initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Aug 15, 2018
1 parent 2286ded commit 0eed5c6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions holoviews/plotting/bokeh/callbacks.py
Expand Up @@ -929,6 +929,7 @@ def initialize(self):
return

plot = self.plot
data = plot.handles['cds'].data
element = self.plot.current_frame
stream = self.streams[0]
kwargs = {}
Expand All @@ -939,15 +940,15 @@ def initialize(self):
param.main.warning('Specifying num_objects to BoxEdit stream '
'only supported for bokeh versions >=1.0.0.')
xs, ys, widths, heights = [], [], [], []
for el in element.split():
x0, x1 = el.range(0)
y0, y1 = el.range(1)
for x, y in zip(data['xs'], data['ys']):
x0, x1 = (np.nanmin(x), np.nanmax(x))
y0, y1 = (np.nanmin(y), np.nanmax(y))
xs.append((x0+x1)/2.)
ys.append((y0+y1)/2.)
widths.append(x1-x0)
heights.append(y1-y0)
data = {'x': xs, 'y': ys, 'width': widths, 'height': heights}
data.update({vd.name: [] for vd in element.vdims})
data.update({vd.name: element.dimension_values(vd, expanded=False) for vd in element.vdims})
rect_source = ColumnDataSource(data=data)
style = self.plot.style[self.plot.cyclic_index]
style.pop('cmap', None)
Expand All @@ -962,7 +963,6 @@ def initialize(self):
stream.update(data=data)



def _process_msg(self, msg):
data = super(BoxEditCallback, self)._process_msg(msg)['data']
x0s, x1s, y0s, y1s = [], [], [], []
Expand Down

0 comments on commit 0eed5c6

Please sign in to comment.