def __init__(self, root_model, link, source_plot, target_plot): try: from bokeh.models.tools import RangeTool except: raise Exception('RangeToolLink requires bokeh >= 0.13') toolbars = list(root_model.select({'type': ToolbarBox})) axes = {} if 'x' in link.axes: axes['x_range'] = target_plot.handles['x_range'] if 'y' in link.axes: axes['y_range'] = target_plot.handles['y_range'] tool = RangeTool(**axes) source_plot.state.add_tools(tool) if toolbars: toolbar = toolbars[0].toolbar toolbar.tools.append(tool)
def __init__(self, root_plot, link, source_plot, target_plot): try: from bokeh.models.tools import RangeTool except: raise Exception('RangeToolLink requires bokeh >= 0.13') toolbar = [model for model in root_plot.state.children if isinstance(model, ToolbarBox)] axes = {} if 'x' in link.axes: axes['x_range'] = target_plot.handles['x_range'] if 'y' in link.axes: axes['y_range'] = target_plot.handles['y_range'] tool = RangeTool(**axes) source_plot.state.add_tools(tool) if toolbar: toolbar = toolbar[0].toolbar toolbar.tools.append(tool)