From e6049c2f08e6e6a663af5402b82cb99b62da6f76 Mon Sep 17 00:00:00 2001 From: yutemi <69854750+yutemi@users.noreply.github.com> Date: Sun, 3 Dec 2023 16:23:40 +0300 Subject: [PATCH] Add TimeSliderChoropleth stroke colour/width/opacity argument (#1838) * added color, width and opacity customization * formatted code --- 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 f98e5fe6b..9065af0e7 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}"