-
-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
927 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from ...selection import OverlaySelectionDisplay | ||
from ...core.options import Store | ||
|
||
|
||
class BokehOverlaySelectionDisplay(OverlaySelectionDisplay): | ||
""" | ||
Overlay selection display subclass for use with bokeh backend | ||
""" | ||
def _build_element_layer( | ||
self, element, layer_color, selection_expr=True | ||
): | ||
element, visible = self._select(element, selection_expr) | ||
|
||
backend_options = Store.options(backend='bokeh') | ||
style_options = backend_options[(type(element).name,)]['style'] | ||
|
||
def alpha_opts(alpha): | ||
options = dict() | ||
|
||
for opt_name in style_options.allowed_keywords: | ||
if 'alpha' in opt_name: | ||
options[opt_name] = alpha | ||
|
||
return options | ||
|
||
layer_alpha = 1.0 if visible else 0.0 | ||
layer_element = element.options( | ||
tools=['box_select'], | ||
**self._get_color_kwarg(layer_color), | ||
**alpha_opts(layer_alpha) | ||
) | ||
|
||
return layer_element |
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
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,29 @@ | ||
from __future__ import absolute_import | ||
from ...selection import OverlaySelectionDisplay | ||
from ...core.options import Store | ||
|
||
|
||
class PlotlyOverlaySelectionDisplay(OverlaySelectionDisplay): | ||
""" | ||
Overlay selection display subclass for use with plotly backend | ||
""" | ||
def _build_element_layer( | ||
self, element, layer_color, selection_expr=True | ||
): | ||
element, visible = self._select(element, selection_expr) | ||
|
||
backend_options = Store.options(backend='plotly') | ||
style_options = backend_options[(type(element).name,)]['style'] | ||
|
||
if 'selectedpoints' in style_options.allowed_keywords: | ||
shared_opts = dict(selectedpoints=False) | ||
else: | ||
shared_opts = dict() | ||
|
||
layer_element = element.options( | ||
visible=visible, | ||
**self._get_color_kwarg(layer_color), | ||
**shared_opts | ||
) | ||
|
||
return layer_element |
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
Oops, something went wrong.