Skip to content

Commit 7d744c9

Browse files
shubhamrajeevpunekarphilippjfr
authored andcommitted
Added styles for PointDraw (#3819) (#4063)
1 parent dfbeb6f commit 7d744c9

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

holoviews/plotting/bokeh/callbacks.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,14 +976,17 @@ def _create_style_callback(self, cds, glyph, length_var):
976976
cds.js_on_change('data', cb)
977977

978978

979-
class PointDrawCallback(CDSCallback):
979+
class PointDrawCallback(GlyphDrawCallback):
980980

981981
def initialize(self, plot_id=None):
982+
plot = self.plot
982983
stream = self.streams[0]
983984
renderers = [self.plot.handles['glyph_renderer']]
984985
kwargs = {}
985986
if stream.num_objects:
986987
kwargs['num_objects'] = stream.num_objects
988+
if stream.styles:
989+
self._create_style_callback(plot.handles['cds'], plot.handles['glyph'], 'x')
987990
point_tool = PointDrawTool(drag=all(s.drag for s in self.streams),
988991
empty_value=stream.empty_value,
989992
renderers=renderers, **kwargs)

holoviews/streams.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,12 +997,17 @@ class PointDraw(CDSStream):
997997
num_objects: int
998998
The number of polygons that can be drawn before overwriting
999999
the oldest polygon.
1000+
1001+
styles: dict
1002+
A dictionary specifying lists of styles to cycle over whenever
1003+
a new Point glyph is drawn.
10001004
"""
10011005

1002-
def __init__(self, empty_value=None, drag=True, num_objects=0, **params):
1006+
def __init__(self, empty_value=None, drag=True, num_objects=0, styles={}, **params):
10031007
self.drag = drag
10041008
self.empty_value = empty_value
10051009
self.num_objects = num_objects
1010+
self.styles = styles
10061011
super(PointDraw, self).__init__(**params)
10071012

10081013
@property

0 commit comments

Comments
 (0)