Feeling completely stuck on this issue. I'm trying to create a scatterplot that highlights specific data points based on clusters when the user hovers over that class of data. To simplify things, I've included the following code snippet with two data clusters.
Below is the JavaScript code:
var svg = d3.selectAll("body").append("svg").attr("width",500).attr("height",500);
svg.append("circle").attr("cx",50).attr("cy",60).attr("r",5).attr("id","circle1");
svg.append("circle").attr("cx",70).attr("cy",100).attr("r",5).attr("id","circle1");
svg.append("circle").attr("cx",50).attr("cy",90).attr("r",5).attr("id","circle2");
svg.append("circle").attr("cx",70).attr("cy",70).attr("r",5).attr("id","circle2");
And here is the CSS code:
svg:hover circle {
opacity: 0.5;
}
svg:hover #circle1:hover ~ #circle2 {
opacity: 1;
}
svg:hover #circle2:hover ~ #circle1 {
opacity: 1;
The first two parts of the CSS are working fine, but for some reason, hovering over circle2 does not change the opacity of circle1.