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.

Leave a Comment