score:1
Accepted answer
The problem is that the style attributes are not valid for the svg element.
Try...
feature.on("mouseover", mouse_over);
function mouse_over(d) {
d3.select(this)
.transition()
.duration(500)
.style("fill", "lightBlue")
.style("stroke", "white");
}
Or...
feature.on("mouseover", mouse_over);
function mouse_over(d) {
d3.select(this)
.transition()
.duration(500)
.style({fill: "lightBlue", stroke: "white"});
}
Or...
feature.on("mouseover", mouse_over);
function mouse_over(d) {
d3.select(this)
.transition()
.duration(500)
.attr({fill: "lightBlue", stroke: "white"});
}
score:3
If you are using leaflet 1.0, I think the reason is that leaflet has set "pointer-event" as "none": Figure showing SVG within leaflet
which makes the click event cannot be fired. So the solution is quite simple, just set "pointer-event" as "all" by using css, then it works! I have tried it by using leaflet 1.0.
pointer-events: pointer-events description
Source: stackoverflow.com
Related Query
- d3 click handler not working on leaflet map layer
- d3 world map with country click and zoom almost working not quite
- Export leaflet map WITH SVG layer to image
- Why is hover on my d3 map not working properly?
- Double click event not working on D3 version 6.1
- d3.js Date vs Half hour heat map not working
- D3 and mouse events, click test not working
- Tooltip in d3/topojson choropleth map not working
- Not all d3 points are showing in correct position on leaflet map
- D3 Geo map zoom is not working correctly (Canvas)
- Click event not working after interation
- legends Click event not working after iteration
- d3 on click for circles not working
- d3 transition not working when triggered from mouseover/mouseout handler
- d3.js - Zoom and Center on Click - Map scales, points do not
- D3 sankey chart nodes click event not working in google chrome (58.0.3029.110) version
- Scale/zoom D3 layer on Leaflet map to layer bounds
- D3 mapping with geoJson US Map working but not World
- In D3 chart, On Click is not working on circle as expected
- Make SVGs on top of leaflet map not respond to pan events
- D3 map not distinguishing click from select text
- SVG layer not rescale width map layer
- d3 click event do not working after clone element append for drag event
- Click event in not working on D3 US Map, and mouseover event is working on particular states only
- Simple React Map layer not loading until mouseEnter event
- GeoJson element rendered using D3 not scaling correctly on Leaflet map
- D3 Force Directed Graph click event not working
- d3.js on click zoom function not working
- d3 sankey svg text tspan - on click not working
- Map legend color not working since update
More Query from same tag
- Angular-nvD3 Pie Chart Not Displaying
- Arc Tweening is snapping as opposed to animating
- Adding tooltips to circles from an array with D3 JavaScript
- Chained transitions data issues
- D3.JS: implementing Force-Directed Graph for my tag data structure
- Linear scale with labels in D3
- Line chart - how to display data points whilst line path is being drawn
- Customize SVG text in D3 Radial Tree
- Plot density function with 2 or 3 colored areas?
- How can I format the day of the week as a single letter?
- D3 nodes color based on group defined in csv
- d3js svg water droplet or teardrop
- D3 Accessing array in Json object to attribute
- D3 graph not loading.. Showing blank page D3.Js and python
- nvd3 Bubble chart with log scale
- Building a graph from ordered pairs
- change initial zoom in D3.js node graph
- How to change other segments of pie chart on mouseover in D3.js?
- D3.js - Drawing points on map fails due to wrong projection
- Creating a simple pie chart using dc.js
- unable to scale yaxis in d3.js according to the data
- d3js: How to stop all transitions?
- How to break a line in d3.axis.tickFormat?
- Put 2 svg side by side
- d3 - Create new element from the dataset for each node in the selection
- d3: how to drag line elements independently of background
- Dilate SVG element if overlapping another element
- D3.js color by boolean values
- crossfilter.js: group data by month
- c3.js - how to show hand cursor on bar chart hover