Skip to content

Commit

Permalink
Update lookup data in _update_hover
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Oct 25, 2024
1 parent 8f71e46 commit 9e35dda
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions holoviews/plotting/bokeh/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def _hover_opts(self, element):
def _update_hover(self, element):
tool = self.handles['hover']
if isinstance(tool.tooltips, Div):
self._hover_data = element.data
return
super()._update_hover(element)

Expand All @@ -67,7 +68,7 @@ def _init_tools(self, element, callbacks=None):
hover = tool
break

data = element.data
self._hover_data = data = element.data

if hover is None or not (XArrayInterface.applies(data) and "has_selector" in data.attrs):
return tools
Expand Down Expand Up @@ -101,7 +102,7 @@ def _init_tools(self, element, callbacks=None):
)

def on_change(attr, old, new):
data_sel = data.sel(**dict(zip(coords, new)), method="nearest").to_dict()
data_sel = self._hover_data.sel(**dict(zip(coords, new)), method="nearest").to_dict()
# TODO: When ValueOf support formatter remove the rounding
# https://github.com/bokeh/bokeh/issues/14123
data_coords = {dim: round(data_sel['coords'][dim]['data'], 3) for dim in coords}
Expand Down

0 comments on commit 9e35dda

Please sign in to comment.