Skip to content

Commit

Permalink
Ensure RGB hover is handled (#3727)
Browse files Browse the repository at this point in the history
* Ensure RGB hover is handled

* Fixed flakes
  • Loading branch information
philippjfr authored May 20, 2019
1 parent 040b7ca commit d2363a8
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions holoviews/plotting/bokeh/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from bokeh.models import DatetimeAxis, CustomJSHover

from ...core.util import cartesian_product, dimension_sanitizer, isfinite
from ...element import Raster, RGB, HSV
from ...element import Raster
from .element import ElementPlot, ColorbarPlot
from .styles import line_properties, fill_properties, mpl_to_bokeh
from .util import bokeh_version, colormesh
from .util import colormesh


class RasterPlot(ColorbarPlot):
Expand All @@ -28,12 +28,11 @@ class RasterPlot(ColorbarPlot):
def _hover_opts(self, element):
xdim, ydim = element.kdims
tooltips = [(xdim.pprint_label, '$x'), (ydim.pprint_label, '$y')]
if bokeh_version >= '0.12.16' and not isinstance(element, (RGB, HSV)):
vdims = element.vdims
tooltips.append((vdims[0].pprint_label, '@image'))
for vdim in vdims[1:]:
vname = dimension_sanitizer(vdim.name)
tooltips.append((vdim.pprint_label, '@{0}'.format(vname)))
vdims = element.vdims
tooltips.append((vdims[0].pprint_label, '@image'))
for vdim in vdims[1:]:
vname = dimension_sanitizer(vdim.name)
tooltips.append((vdim.pprint_label, '@{0}'.format(vname)))
return tooltips, {}

def _postprocess_hover(self, renderer, source):
Expand Down Expand Up @@ -127,6 +126,11 @@ class RGBPlot(ElementPlot):

_plot_methods = dict(single='image_rgba')

def _hover_opts(self, element):
xdim, ydim = element.kdims
return [(xdim.pprint_label, '$x'), (ydim.pprint_label, '$y'),
('RGBA', '@image')], {}

def get_data(self, element, ranges, style):
mapping = dict(image='image', x='x', y='y', dw='dw', dh='dh')
if 'alpha' in style:
Expand Down

0 comments on commit d2363a8

Please sign in to comment.