Skip to content

Only restyle own paths in TimeSliderChoropleth - #2390

Open
VolodymyrLinuxovich wants to merge 1 commit into
python-visualization:mainfrom
VolodymyrLinuxovich:timeslider-choropleth-own-paths
Open

VolodymyrLinuxovich wants to merge 1 commit into
python-visualization:mainfrom
VolodymyrLinuxovich:timeslider-choropleth-own-paths

Conversation

@VolodymyrLinuxovich

Copy link
Copy Markdown

TimeSliderChoropleth styles its features when the layer is added. It did this with d3.selectAll('path'), which picks up every SVG path on the page. So any other GeoJson layer on the same map got a thin white dashed stroke and a fill opacity of zero. The small flag in the Leaflet attribution went blank too.

I checked this in a headless browser with a red and blue GeoJson polygon next to a slider layer. Before the change the polygon came out white, dashed and unfilled. After the change it keeps its own style and the slider features look the same as before.

The selector now only matches paths whose id starts with the layer's feature prefix. Those ids are set a few lines above in the same handler. I added a test that checks the rendered script uses the scoped selector.

The overlay add handler selected every path on the page and reset its
stroke and fill opacity. Other GeoJson layers on the same map lost their
style and the Leaflet attribution flag went blank. Select only the paths
that belong to this layer.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant