はフルフィドルです:https://jsfiddle.net/mbcu05z8/27/
私はあなたがやったように、変数の配列に格納:
var myArr= [{"id":"AL","Under 5":310504,"5 to 13":552339,"14 to 17":259034,"total":1121877},{"id":"AK","Under 5":52083,"5 to 13":85640,"14 to 17":42153,"total":179876},{"id":"AZ","Under 5":515910,"5 to 13":828669,"14 to 17":362642,"total":1707221}];
はその後、私はdraw()
という名前のカスタム関数にd3.csv
を変更し、ちょうど:-)それを呼びました
draw(myArr);
function draw(states) {
var stateById = d3.map();
states.forEach(function(d) {
stateById.set(d.id, d);
});
setTimeout(()=>{
dispatch.call("load", window, stateById);
dispatch.call("statechange", window, stateById.get("AL"));
},20);
};