Skip to content

Commit ab77557

Browse files
tblundyTim Blundy
andauthored
Hover tooltips for TimestampedGeoJson (#1472)
* Add tooltips to TimestampedGeoJson * Alter test template to match * Add to example in docstring Co-authored-by: Tim Blundy <[email protected]>
1 parent c25c84c commit ab77557

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

folium/plugins/timestamped_geo_json.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ class TimestampedGeoJson(JSCSSMixin, MacroElement):
6868
... 'coordinates': [[-70,-25],[-70,35],[70,35]],
6969
... },
7070
... 'properties': {
71-
... 'times': [1435708800000, 1435795200000, 1435881600000]
72-
... }
71+
... 'times': [1435708800000, 1435795200000, 1435881600000],
72+
... 'tooltip': 'my tooltip text'
73+
... },
7374
... }
7475
... ]
7576
... })
@@ -124,6 +125,9 @@ class TimestampedGeoJson(JSCSSMixin, MacroElement):
124125
if (feature.properties.popup) {
125126
layer.bindPopup(feature.properties.popup);
126127
}
128+
if (feature.properties.tooltip) {
129+
layer.bindTooltip(feature.properties.tooltip);
130+
}
127131
}
128132
})
129133

tests/plugins/test_timestamped_geo_json.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ def test_timestamped_geo_json():
151151
if (feature.properties.popup) {
152152
layer.bindPopup(feature.properties.popup);
153153
}
154+
if (feature.properties.tooltip) {
155+
layer.bindTooltip(feature.properties.tooltip);
156+
}
154157
}
155158
})
156159

0 commit comments

Comments
 (0)