Skip to content

Commit

Permalink
Replace {get,set}() with getters and setters
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpap committed Sep 14, 2016
1 parent 50ffc54 commit 8650741
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
12 changes: 6 additions & 6 deletions datashader/bokeh_ext.py
Expand Up @@ -86,10 +86,10 @@ class InteractiveImage(object):
var plot = x_range.plots[0];
// Generate a command to execute in Python
var ranges = {{xmin: x_range.attributes.start,
ymin: y_range.attributes.start,
xmax: x_range.attributes.end,
ymax: y_range.attributes.end,
var ranges = {{xmin: x_range.start,
ymin: y_range.start,
xmax: x_range.end,
ymax: y_range.end,
w: Math.floor(plot.width),
h: Math.floor(plot.height)}}
var range_str = JSON.stringify(ranges)
Expand Down Expand Up @@ -127,7 +127,7 @@ def __init__(self, bokeh_plot, callback, delay=200, timeout=2000, throttle=None,
self.timeout = timeout
if throttle:
print("Warning: throttle parameter no longer supported; will not be accepted in future versions")

# Initialize the image and callback
self.ds, self.renderer = self._init_image()
callback = self._init_callback()
Expand Down Expand Up @@ -293,7 +293,7 @@ def __init__(self,
size=size)
self.tooltips = []

code = "source.set('selected', cb_data['index']);"
code = "source.selected = cb_data['index'];"
self._callback = CustomJS(args={'source': self.hover_data}, code=code)

self.renderer = GlyphRenderer()
Expand Down
17 changes: 9 additions & 8 deletions examples/raster.py
Expand Up @@ -52,14 +52,15 @@ def update_image():
dims.on_change('data', on_dims_change)
dims_jscode = """
var update_dims = function () {
var new_data = {};
new_data['height'] = [plot.get('frame').get('height')];
new_data['width'] = [plot.get('frame').get('width')];
new_data['xmin'] = [plot.get('x_range').get('start')];
new_data['ymin'] = [plot.get('y_range').get('start')];
new_data['xmax'] = [plot.get('x_range').get('end')];
new_data['ymax'] = [plot.get('y_range').get('end')];
dims.set('data', new_data);
var new_data = {
height: [plot.frame.height],
width: [plot.frame.width],
xmin: [plot.x_range.start],
ymin: [plot.y_range.start],
xmax: [plot.x_range.end],
ymax: [plot.y_range.end]
};
dims.data = new_data;
};
if (typeof throttle != 'undefined' && throttle != null) {
Expand Down
17 changes: 9 additions & 8 deletions examples/streaming.py
Expand Up @@ -112,14 +112,15 @@ def update_image(dataframe):
dims = ColumnDataSource(data=dict(width=[], height=[], xmin=[], xmax=[], ymin=[], ymax=[]))
dims_jscode = """
var update_dims = function () {
var new_data = {};
new_data['height'] = [plot.get('frame').get('height')];
new_data['width'] = [plot.get('frame').get('width')];
new_data['xmin'] = [plot.get('x_range').get('start')];
new_data['ymin'] = [plot.get('y_range').get('start')];
new_data['xmax'] = [plot.get('x_range').get('end')];
new_data['ymax'] = [plot.get('y_range').get('end')];
dims.set('data', new_data);
var new_data = {
height: [plot.frame.height],
width: [plot.frame.width],
xmin: [plot.x_range.start],
ymin: [plot.y_range.start],
xmax: [plot.x_range.end],
ymax: [plot.y_range.end]
};
dims.data = new_data;
};
if (typeof throttle != 'undefined' && throttle != null) {
Expand Down

0 comments on commit 8650741

Please sign in to comment.