加載美國郵政編碼topojson文件後,我在d3.js中收到錯誤。 groupdata
未定義在這條線:映射美國郵政編碼與topojson的錯誤
function bind(group, groupData) {
var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
與錯誤:
Uncaught TypeError: Cannot read property 'length' of undefined
我的代碼正在調用和創建的路徑是:
d3.json("data/us-atlas/us-zipcodes.json", function(error, topology) {
svg.selectAll("path")
.data(topojson.feature(topology, topology.objects.zipcodes).features)
.enter()
.append("path")
.attr("d", path)
});
我產生的郵政編碼topojson文件從此回購:https://github.com/mbostock/us-atlas。當我在加載時檢查拓撲對象時,我在topology.objects.zipcodes下看到了32893個弧。
我已成功加載縣下的chloropleth示例http://bl.ocks.org/mbostock/4060606,並使用類似的模式。
我使用d3.js版本3.2.8和topojson.js版本1.2.3。
任何想法?這是一個糟糕的郵政編碼文件,或者我說錯了嗎?
如果你有一個[要點](https://gist.github.com/ )顯示你的代碼可以幫助我們。 – Hugolpz