score:3

Accepted answer

inside of your click function set the visible flag on all the lines:

  .on("click", function(d){ // on click make d.visible 
    // visible is true if the start of the name matches        
    categories.foreach(function(e){
      e.visible = e.name.slice(0, 5) == d.name.slice(0, 5)
    })

http://codepen.io/1wheel/pen/bwyaqe?editors=0011

to turn multiple sections on at once, flip the visible flag for just categories that match:

  .on("click", function(d){
    categories.foreach(function(e){
      e.visible = e.name.slice(0, 5) == d.name.slice(0, 5) ? !e.visible : e.visible
    })

Related Query

More Query from same tag