Skip to content

Commit 5ef7a91

Browse files
authored
Include a new trait key_on in Choropleth Map (#537)
1 parent 17fc93a commit 5ef7a91

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ipyleaflet/leaflet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ class Choropleth(GeoJSON):
612612
value_min = Float(None, allow_none=True)
613613
value_max = Float(None, allow_none=True)
614614
colormap = Instance(ColorMap)
615+
key_on = Unicode('id')
615616

616617
@observe('choro_data')
617618
def _update_bounds(self, change):
@@ -650,7 +651,7 @@ def _get_data(self):
650651
data = copy.deepcopy(self.geo_data)
651652

652653
for feature in data['features']:
653-
feature['properties']['style'] = self.style_callback(feature, colormap, self.choro_data[feature['id']])
654+
feature['properties']['style'] = self.style_callback(feature, colormap, self.choro_data[feature[self.key_on]])
654655

655656
return data
656657

0 commit comments

Comments
 (0)