Skip to content

Commit

Permalink
Fix hover formatting for Mercator coordinates (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Sep 20, 2019
1 parent 65e3b96 commit 4772547
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions geoviews/plotting/bokeh/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
from cartopy.crs import GOOGLE_MERCATOR, PlateCarree, Mercator
from bokeh.models.tools import BoxZoomTool, WheelZoomTool
from bokeh.models import MercatorTickFormatter, MercatorTicker
from holoviews.core.dimension import Dimension
from holoviews.core.util import dimension_sanitizer, basestring
from holoviews.plotting.bokeh.element import ElementPlot, OverlayPlot as HvOverlayPlot
from holoviews.plotting.bokeh.util import bokeh_version
from holoviews.core.util import dimension_sanitizer, basestring

from ...element import is_geographic, _Element, Shape
from ..plot import ProjectionPlot
Expand Down Expand Up @@ -150,10 +151,17 @@ def _postprocess_hover(self, renderer, source):
hover.tooltips = tooltips
hover.formatters = formatters

def _update_hover(self, element):
tooltips, hover_opts = self._hover_opts(element)
hover = self.handles['hover']
tooltips = [(ttp.pprint_label, '@{%s}' % dimension_sanitizer(ttp.name))
if isinstance(ttp, Dimension) else ttp for ttp in tooltips]
tooltips = [(l, t+'{custom}' if t in hover.formatters else t) for l, t in tooltips]
self.handles['hover'].tooltips = tooltips

def get_data(self, element, ranges, style):
proj = self.projection
if self._project_operation and self.geographic:
element = self._project_operation(element, projection=proj)
element = self._project_operation(element, projection=self.projection)
return super(GeoPlot, self).get_data(element, ranges, style)


Expand Down

0 comments on commit 4772547

Please sign in to comment.