你能看一下嗎?沒有出現地圖
。https://codepen.io/DeanWinchester88/pen/BaZYewv
async function chart(){
const [data,geo] = await Promise.all([
d3.json(promises[0)。
d3.json(promises[1])
])
console.log("data"/span>,data)
console.log("geo", geo)
}
chart()
let path = d3.geoPath()
function ready(error,data,geo){
//topojson物件。
let topoobject = topojson.feature(geo, geo.objects.counties) 。
let counties = topoobject.features;
uj5u.com熱心網友回復:
你需要將資料傳遞給ready函式。現在在你的代碼中,ready函式從未被呼叫。你可以這樣做:
Promise.all( [
d3.json(EDUCATION) 。
d3.json(COUNTIES) 。
]).then(([data, geo]/span>) => {
ready(null, data, geo)。
});
另外,在EDUCATION url中存在一個錯誤。它應該是:
const EDUCATION = "https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/for_user_education.json"/span>。
const COUNTIES = "https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/counties.json"。
最后,ready的第一行拼錯了topojson。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/331502.html
標籤:
下一篇:點擊時不要改變按鈕的界面
