I am trying to build a table with multiple nested dropdowns using d3.js. When I use a newer version of d3 my code works just fine, however for various reasons I need to use d3.js v3 and when I replace the newer version with the older version I get the following:
Uncaught TypeError: options4.enter(...).append(...).merge is not a function
I'm assuming the older version of d3 doesn't have a merge() function, however I'm at a loss as to what to substitute it with.
Here is my code:
<script src="https://d3js.org/d3.v3.min.js"></script>
var colorScheme = d3.scale.ordinal()
.domain(["USA", "PRI", "CAN"])
.range(["#d52922", "#d69105", "#4b7ba1"]);
var jobsCsvData = null;
d3.csv("master_info_final_v12_conversion.csv", function(data) {
data.forEach(function(d) {
d["index"] = d["index"];
d["name"] = d["name"];
d["city"] = d["city"];
d["state"] = d["state"];
d["country"] = d["country"];
});
JobsCsvData = data;
var nestedTwo = d3.nest()
.key(function(d) {
return d.country;
})
.key(function(d) {
return d.state;
})
.key(function(d) {
return d.city;
})
.entries(data);
function updateLocationValues(g) {
var filtered = filtered2[0].values.filter(function(d) {
return d.key == g;
});
var options5 = d3.select("#select5")
.selectAll("option")
.data(filtered[0].values.map(function(d) {
//.data(filtered3[0].values.map(function(d) {
return d.key;
}));
options5.exit().remove();
Here is the merge() function giving me my problems.
options5.enter()
.append("option")
.merge(options5)
.text(function(d) {
return d;
});
tabulate(data);
}
var options5 = d3.select("#select5")
.selectAll("option")
.data(filtered3[0].values.map(function(d) {
return d.key;
}.)).enter()
.append("option")
.text(function(d) {
return d;
});
.... {more code}
}
There's more code which I can include if this isn't sufficient. Any help would be immensely appreciated.