I have a CSV file which looks like this:
Category,Value
category1,162
category1,151
category2,124
category1,135
category2,315
I would like to create an exclusive unordered list of the categories (no duplicates of the categories), so the list should look like this:
<ul>
<li>category1</li>
<li>category2</li>
</ul>
The array is quite big, so it should be fast. This is what I have so far (displaying some part of the CSV as scatterplot):
d3.csv("data.csv", function(error, data) {
data.forEach(function(d) {
d.Value = +d.Value;
});
svg.selectAll(".dot")
.data(data)
.enter().append("circle")
.attr("class", "dot")
.attr("r", 1)
.attr("cx", function(d) { return x(d.Value); })
.attr("cy", 10);
What’s the best way to create the category list besides the svg?