Reputation: 1351
I am trying to remove a path and it the circles that are placed on it when a text label is clicked.
The line is removed on click but I am having trouble removing the circles too.
The d3 code to remove the path is as follows.
.on("click", function () {
// Determine if current line is visible
var active = d.active ? false : true;
var newOpacity = active ? 0 : 1;
// Hide or show the elements based on the ID
d3.select("#line" + d.key.replace(/\s+/g, ''))
.transition().duration(500)
.style("opacity", newOpacity);
// Update whether or not the elements are active
d.active = active;
})
Please see the Plunker link for a better example for the whole code.
Upvotes: 0
Views: 674