Skip to content

Commit

Permalink
Add reset_start and reset_end to RangeToolLink (#5848)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Aug 9, 2023
1 parent 5ba6537 commit ee01948
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions holoviews/plotting/bokeh/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ def __init__(self, root_model, link, source_plot, target_plot):
start, end = bounds
if start is not None:
axes[f'{axis}_range'].start = start
axes[f'{axis}_range'].reset_start = start
if end is not None:
axes[f'{axis}_range'].end = end
axes[f'{axis}_range'].reset_end = end

tool = RangeTool(**axes)
source_plot.state.add_tools(tool)
Expand Down
4 changes: 4 additions & 0 deletions holoviews/tests/plotting/bokeh/test_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def test_range_tool_link_callback_boundsx_arg(self):
tgt_plot = plot.subplots[(0, 0)].subplots['main']
self.assertEqual(tgt_plot.handles['x_range'].start, x_start)
self.assertEqual(tgt_plot.handles['x_range'].end, x_end)
self.assertEqual(tgt_plot.handles['x_range'].reset_start, x_start)
self.assertEqual(tgt_plot.handles['x_range'].reset_end, x_end)

def test_range_tool_link_callback_boundsy_arg(self):
array = np.random.rand(100, 2)
Expand All @@ -65,6 +67,8 @@ def test_range_tool_link_callback_boundsy_arg(self):
tgt_plot = plot.subplots[(0, 0)].subplots['main']
self.assertEqual(tgt_plot.handles['y_range'].start, y_start)
self.assertEqual(tgt_plot.handles['y_range'].end, y_end)
self.assertEqual(tgt_plot.handles['y_range'].reset_start, y_start)
self.assertEqual(tgt_plot.handles['y_range'].reset_end, y_end)

def test_data_link_dynamicmap_table(self):
dmap = DynamicMap(lambda X: Points([(0, X)]), kdims='X').redim.range(X=(-1, 1))
Expand Down

0 comments on commit ee01948

Please sign in to comment.