title: Filtering Data with on click function
body: <p>I have two array objects that hold my d3.svg.symbol types which are circles, squares &amp; triangles. Array #1 has multiple symbols which I plot across the canvas, whereas array #2 only holds three symbols aligned together. </p>
  
  <p>My goal is to be able to click on array #2 to filter out all of the array #1 symbols that i dont want to see. e.g. Clicking a circle in array #2 would only mean circles are shown in array #1. </p>
  
  <pre><code>      var array1 = svg.selectAll(a.array1)
                     .data(json).enter().append("a")
  
            array1.transition().duration(1000)
               .attr("transform", function(d,i) {return "translate("+d.x+","+d.y+")" ;})
  
  
            array1.append('path')
                  .attr("d", d3.svg.symbol().type(function(d) {return shape [d.Country];}).size(120))
  
  
        var array2 = svg.selectAll(g.array2)
                       .data(filt)
                       .enter().append("g")
                       .attr("transform", function(d,i) {return "translate("+d.x+","+d.y+")" ;})
  
            array2.append("path")
            .attr("d", d3.svg.symbol().type(function(d){return d.shape;}).size(200))
            .attr("transform", "translate(-10, -5)")
  </code></pre>
  
  <p>So my query is how do I specify the click onto array#2 specific types as I have three. Therefore, I would like all to be clickable, but have a different outcome.</p>
  
  <p>So far I have tried this just to try &amp; select specific shapes in array#2</p>
  
  <pre><code>       array2.on("click", function(){    alert('success')  })
  </code></pre>
  
  <p>which just alerts when I click any of them, however when this is applied: </p>
  
  <pre><code>    array2.on("click", function(){ if (d3.svg.symbol().type('circle') === true) { return  alert('success') ;};  })
  </code></pre>
  
  <p>When I click the circle of array2 it doesnt alert at all. </p>
  
  <p>It would be great if I could get some help - thanks. <a href="http://jsfiddle.net/Zc4z9/16/" rel="nofollow">http://jsfiddle.net/Zc4z9/16/</a></p>