이 bl.ocks 내 d3.js지도입니다 연도에 따라 JSON지도를 전환 http://bl.ocks.org/textplusdata/f64f54dd8c1a0b632ed5 당신은 시간이 지남에 따라 변화를 보여 년간의 데이터를 순환 화살표 키 또는 자동 재생을 사용할 수있는 원시 버전에d3.js 여기
.
내 질문은 여기 있습니다. 어떻게하면 올해에 따라 다른 세계 json 파일을로드 할 수 있습니까? 1991 년 이전에는 옛 소련이 존재하지만 그 자료에는 나타나지 않는다.
이미 두 개의 jsons가 업로드되어 있습니다. 하나는 오래된 소련 노조가 있고 다른 하나는 제외 된 것입니다.
// The map
var maptype;
if (parseInt(year) < 1991) maptype = world_countriesold;
if (parseInt(year) > 1991) maptype = world_countries;
var countries = d3.select("g#countries").empty() ?
chart.append("g").attr("id", "countries") : d3.select("g#countries"),
country = countries
.selectAll("path")
.data(maptype.features);
country
.enter()
.append("path")
.classed("country", true)
// changed { return d.id; } to { return d.ISO1AL3; } to look up 3-letter country code in c-shapes json
.attr("id", function(d,i) { return d.id; })
// changed { return d.properties.name; } to { return d.properties.CNTRY_NAME; } to return correct field in c-shapes json
.attr("title", function(d,i) { return d.properties.name; })
.attr("d", path);
난 그냥 넣어 가지고 추측