2652763
2652763

Reputation: 513

Hiding text elements in D3 chord diagram

Similar to this example:

enter image description here

I have a function that highlights the chords linked to the selected group and hides all unrelated chords:

function fade() {
    return function(d, i) {
        svg.selectAll("path.chord")
        .filter(function(d) {
            return d.source.index != i && d.target.index != i;
        })
        .style("visibility", "hidden");
    };
}

I was trying to extend this so that it not only hides the chords, but also the text labels for groups that are not connected to the currently selected group.

Is it possible to combine these two operations into a single function that I pass to .on("mouseover",[function])?

Upvotes: 1

Views: 3220

Answers (1)

justinjhendrick
justinjhendrick

Reputation: 435

You can select with a logical OR like this:

svg.selectAll("path.chord, text.groupLabel")

see the documentation on selections for more details

Upvotes: 3

Related Questions