javascript - Unable to select data with d3.defer -
i'm stuck stupid problem in d3 map. load 2 files, , fine, colors here, etc. however, i'm not able adjust opacity, because takes data in json, not in csv, if/else. here sample of code:
queue() .defer(d3.json, "data/countries.json") .defer(d3.csv, "data/data.csv") .await(ready); function ready(error, map, data) { if (error) throw error; var ratebyid = d3.map(); var paths = g.append("g") .attr("class", "countries") .selectall("path") .data(topojson.feature(map, map.objects.countries).features) .enter() .append("path") .attr("opacity", function(d) { var value = data.id; if (value) { return ".8"; } else { return ".1"; } }) // ... });
any idea how aim correctly "id" column in data.csv? thank you.
Comments
Post a Comment