To plot a map using D3.js we use the following code:
G
.selectAll("path")
.data(topojson.feature(topology, topology.objects.MU3303906MU).features)
.join("path")
.attr("class", "state-county")
But I'd like to use a variable inside .data(topojson.feature(topology, topology.objects.MU3303906MU).features) to change MU3303906MU with other values when necessary.
How is it possible?
I tried:
var CODEHERE = "MUXXXXXXXMU";
.data(topojson.feature(topology, topology.objects.CODEHERE).features)
or
.data(topojson.feature(topology, topology.objects.+ CODEHERE +).features) //syntax error
But none worked.