我有一个d3等值区,错误“无法读取未定义的属性'对象'。我究竟如何测试这个。不确定topojson
如何运作...
queue()
// Load map JSON
.defer(d3.json, 'https://rawgit.com/HyperrealTech/thorn-directives/master/lib/us.json')
// Load applicable data
.defer(d3.json, data)
// Call rateById for each d in data
.await(function(d) {
rateById.set(d.state, +d.count);
})
// Once finished loading, call ready function
.await(ready);
// Ready function
function ready(error, us) {
// Append states to svg
svg.append('g')
.attr('class', 'states')
.selectAll('path')
.data(topojson.feature(us, us.objects.states).features)
.enter().append('path')
.style('fill', function(d) {
return color(rateById.get(d.state));
})
.attr('d', path)