How to select unique values in d3.js from data
d3.js, html, javascript
Solution
Filter your data retaining unique keys only by `d3.map`
d3.select("#road").selectAll("option")
.data(d3.map(data, function(d){return d.roadname;}).keys())
.enter()
.append("option")
.text(function(d){return d;})
.attr("value",function(d){return d;});
Problem
I am using the following code to populate my Combobox using d3.js ``` d3.csv("Results_New.txt", function(data) { dataset=data; d3.select("#road").selectAll("option") .data(data).enter().append("option").text(function(d){return d.roadname;}).attr("value",function(d){return d.roadname;}); }); ``` There are different rows with the same name. The combobox is populating with these duplicate names. For example in multiple rows the name of the road is I-80.But in the combobox I want to see I-80 only once. How can I do that?