gaitat
gaitat

Reputation: 12642

D3 How to I get the size of the data after filtering

If I use this code, for example, to get the odd indexed data values

d3.select("body").selectAll("div")
    .data([4, 8, 15, 16, 23, 42]
        .filter(function(d, i) { return i & 1; }))
    .enter().append("div")
        .text(function(d) { return d; });

how can I get the size of the data after the filtering operation.

Upvotes: 0

Views: 337

Answers (1)

Lars Kotthoff
Lars Kotthoff

Reputation: 109282

Use selection.size() for that.

Upvotes: 2

Related Questions