From 3435ba0612ff3fc429f3fe688a7667159e2fbffc Mon Sep 17 00:00:00 2001 From: yutemi Date: Mon, 27 Nov 2023 18:02:01 +0500 Subject: [PATCH 1/2] added color, width and opacity customization --- folium/plugins/time_slider_choropleth.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/folium/plugins/time_slider_choropleth.py b/folium/plugins/time_slider_choropleth.py index f98e5fe6b9..96855dbc39 100644 --- a/folium/plugins/time_slider_choropleth.py +++ b/folium/plugins/time_slider_choropleth.py @@ -133,9 +133,10 @@ class TimeSliderChoropleth(JSCSSMixin, Layer): $("#slider_{{ this.get_name() }}").show(); d3.selectAll('path') - .attr('stroke', 'white') - .attr('stroke-width', 0.8) + .attr('stroke', '{{ this.stroke_color }}') + .attr('stroke-width', {{ this.stroke_width }}) .attr('stroke-dasharray', '5,5') + .attr('stroke-opacity', {{ this.stroke_opacity }}) .attr('fill-opacity', 0); fill_map(); @@ -166,11 +167,18 @@ def __init__( control=True, show=True, init_timestamp=0, + stroke_opacity=1, + stroke_width=0.8, + stroke_color='#FFFFFF', ): super().__init__(name=name, overlay=overlay, control=control, show=show) self.data = GeoJson.process_data(GeoJson({}), data) self.highlight = highlight + self.stroke_opacity = stroke_opacity + self.stroke_width = stroke_width + self.stroke_color = stroke_color + if not isinstance(styledict, dict): raise ValueError( f"styledict must be a dictionary, got {styledict!r}" From 79ba47d945a8f53797cbc0d1acedc27e4c5ac802 Mon Sep 17 00:00:00 2001 From: yutemi Date: Sat, 2 Dec 2023 20:16:15 +0500 Subject: [PATCH 2/2] formatted code --- folium/plugins/time_slider_choropleth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folium/plugins/time_slider_choropleth.py b/folium/plugins/time_slider_choropleth.py index 96855dbc39..9065af0e7c 100644 --- a/folium/plugins/time_slider_choropleth.py +++ b/folium/plugins/time_slider_choropleth.py @@ -169,7 +169,7 @@ def __init__( init_timestamp=0, stroke_opacity=1, stroke_width=0.8, - stroke_color='#FFFFFF', + stroke_color="#FFFFFF", ): super().__init__(name=name, overlay=overlay, control=control, show=show) self.data = GeoJson.process_data(GeoJson({}), data)