From 326aed8f7d43e3de6243bd27f117ac1f5b4ede61 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 2 Jun 2020 22:13:41 +0200 Subject: [PATCH] working pop up --- rowers/interactiveplots.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 3833dda9..2d4980bb 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -2197,6 +2197,11 @@ def leaflet_chart_compare(course,workoutids,labeldict={},startenddict={}): startsecond = 0 endsecond = 0 + try: + label = labeldict[id] + except KeyError: + label = str(id) + group.sort_values(by='time',ascending=True,inplace=True) group.dropna(axis=0,how='any',inplace=True) if endsecond > 0: @@ -2220,10 +2225,15 @@ def leaflet_chart_compare(course,workoutids,labeldict={},startenddict={}): script += """ var latlongs = {scoordinates} var polyline = L.polyline(latlongs, {{color:'{color}'}}).addTo(mymap) + polyline.bindPopup("{label}") + polyline.on('mouseover',function(ev) {{ + ev.target.openPopup(); + }}); mymap.fitBounds(polyline.getBounds()) """.format( scoordinates=scoordinates, color=color, + label=label ) script += """