Skip to content

Commit e6049c2

Browse files
Add TimeSliderChoropleth stroke colour/width/opacity argument (#1838)
* added color, width and opacity customization * formatted code
1 parent 775b867 commit e6049c2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: folium/plugins/time_slider_choropleth.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ class TimeSliderChoropleth(JSCSSMixin, Layer):
133133
$("#slider_{{ this.get_name() }}").show();
134134
135135
d3.selectAll('path')
136-
.attr('stroke', 'white')
137-
.attr('stroke-width', 0.8)
136+
.attr('stroke', '{{ this.stroke_color }}')
137+
.attr('stroke-width', {{ this.stroke_width }})
138138
.attr('stroke-dasharray', '5,5')
139+
.attr('stroke-opacity', {{ this.stroke_opacity }})
139140
.attr('fill-opacity', 0);
140141
141142
fill_map();
@@ -166,11 +167,18 @@ def __init__(
166167
control=True,
167168
show=True,
168169
init_timestamp=0,
170+
stroke_opacity=1,
171+
stroke_width=0.8,
172+
stroke_color="#FFFFFF",
169173
):
170174
super().__init__(name=name, overlay=overlay, control=control, show=show)
171175
self.data = GeoJson.process_data(GeoJson({}), data)
172176
self.highlight = highlight
173177

178+
self.stroke_opacity = stroke_opacity
179+
self.stroke_width = stroke_width
180+
self.stroke_color = stroke_color
181+
174182
if not isinstance(styledict, dict):
175183
raise ValueError(
176184
f"styledict must be a dictionary, got {styledict!r}"

0 commit comments

Comments
 (0)