0

I'm trying to filter out an array using D3. I have nested it and taken an map of the keys from a csv file. I want to filter it to show the values that match any of those keys in the array but am getting blank whenever I check the console after filtering.

var id = d3.nest()
           .key(function(d) {return d.id})
           .map(rows);        
id = d3.keys(id);
id.filter(function(d){d==input})

1 Answer 1

1

Just a work around but I created a function to filter the array which works for me.

function contain_item(item){
  return(item == input);
}

id = id.filter(contain_item);
Sign up to request clarification or add additional context in comments.

1 Comment

The callback in your question's snippet is missing the return, which is included in function contain_item(). This is not a work around, but the solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.