d3 Choropleth:无法读取未定义的属性“对象”

时间:2014-07-10 01:43:54

标签: javascript d3.js

我有一个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)

0 个答案:

没有答案