javascript - Using on click & selectAll to remove existing data -


i have set of randomly plotted diamonds, squares & circles on canvas. have 1 of each lined in straight line created go variable. wish use onclick function upon variable filter or make shapes disappear depending on parameter give it. e.g. squares show squares on canvas etc.

so far have started basic example:

  .on("click", function(d){ if (d.shape == 'square') { return  alert('success') ;}  }) 

i moved onto this:

 .on("click", function(d){ if (d.shape =='circle')  { return d3.selectall(".node").filter(function(d) {return d.country === 'usa'} )  } ;}) 

when have applied that, doesnt result errors or actions. i'm pretty sure i'm going in right direction, getting there

http://jsfiddle.net/zc4z9/19/

thanks, in advance!

you doing nothing selection. if need hide add .style("display", "none")

 .on("click", function(d){       if (d.shape =='circle')  {          d3.selectall(".node")           .filter(function(d) {return d.country === 'usa'} )           .style("display", "none");      }   }) 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -