d3 selectAll: count results

Just use d3.selectAll(data).size().Hope this example help you: var matrix = [ [11975, 5871, 8916, 2868], [ 1951, 10048, 2060, 6171], [ 8010, 16145, 8090, 8045], [ 1013, 990, 940, 6907] ]; var tr = d3.select(“body”).append(“table”).selectAll(“tr”) .data(matrix) .enter().append(“tr”); var td = tr.selectAll(“td”) .data(function(d) { return d; }) .enter().append(“td”) .text(function(d) { return d; }); var tdSize=tr.selectAll(“td”).size(); Complete … Read more

How to use D3 selectAll with multiple class names

The most D3 way to do this would be to chain the selectors using the filter method: var list1 = d3.selectAll(“.mYc”).filter(“.101″); This won’t work though because class names cannot start with a number. So you have to rename to something like “a101” and then you can do var list1 = d3.selectAll(“.mYc”).filter(“.a101”); See this fiddle.

How to implement “select all” check box in HTML?

<script language=”JavaScript”> function toggle(source) { checkboxes = document.getElementsByName(‘foo’); for(var checkbox in checkboxes) checkbox.checked = source.checked; } </script> <input type=”checkbox” onClick=”toggle(this)” /> Toggle All<br/> <input type=”checkbox” name=”foo” value=”bar1″> Bar 1<br/> <input type=”checkbox” name=”foo” value=”bar2″> Bar 2<br/> <input type=”checkbox” name=”foo” value=”bar3″> Bar 3<br/> <input type=”checkbox” name=”foo” value=”bar4″> Bar 4<br/> UPDATE: The for each…in construct doesn’t seem to … Read more