-
-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Buffer following behavior toggleable (#3823)
- Loading branch information
1 parent
79d43ad
commit dbfb809
Showing
4 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import numpy as np | ||
|
||
from holoviews.core import DynamicMap | ||
from holoviews.element import Curve | ||
from holoviews.streams import Buffer | ||
|
||
from .testplot import TestBokehPlot, bokeh_renderer | ||
|
||
|
||
class TestBufferStreamPlot(TestBokehPlot): | ||
|
||
def test_buffer_stream_following(self): | ||
stream = Buffer(data={'x': np.array([1]), 'y': np.array([1])}, following=True) | ||
dmap = DynamicMap(Curve, streams=[stream]) | ||
|
||
plot = bokeh_renderer.get_plot(dmap) | ||
|
||
x_range = plot.handles['x_range'] | ||
y_range = plot.handles['y_range'] | ||
|
||
self.assertEqual(x_range.start, 0) | ||
self.assertEqual(x_range.end, 2) | ||
self.assertEqual(y_range.start, 0) | ||
self.assertEqual(y_range.end, 2) | ||
|
||
stream.send({'x': np.array([2]), 'y': np.array([-1])}) | ||
|
||
self.assertEqual(x_range.start, 1) | ||
self.assertEqual(x_range.end, 2) | ||
self.assertEqual(y_range.start, -1) | ||
self.assertEqual(y_range.end, 1) | ||
|
||
stream.following = False | ||
|
||
stream.send({'x': np.array([3]), 'y': np.array([3])}) | ||
|
||
self.assertEqual(x_range.start, 1) | ||
self.assertEqual(x_range.end, 2) | ||
self.assertEqual(y_range.start, -1) | ||
self.assertEqual(y_range.end, 1) |