0
나는이 파일 다운로드 : https://gist.github.com/markmarkoh/2969317이 JSON을 월드 맵으로 만드는 방법은 무엇입니까?
을 그리고이 코드로 시도 :
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
stroke: white;
stroke-width: 0.25px;
fill: grey;
}
</style>
<body>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
<script src="gistfile1.js"></script>
<script>
var width = 960,
height = 500;
var projection = d3.geo.mercator()
.center([0, 5 ])
.scale(900)
.rotate([-180,0]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var path = d3.geo.path()
.projection(projection);
var g = svg.append("g");
// load and display the World
d3.json("gistfile1.json", function(error, topology) {
g.selectAll("path")
.data(topojson.object(topology, topology.objects.countries)
.geometries)
.enter()
.append("path")
.attr("d", path)
});
</script>
</body>
</html>
을하지만 그것은 작동하지 않습니다. 나는 잃어버린 일종의 세계지도에 새로운 사람들이다. 나는 약간의 튜토리얼을 시도했지만 작동시키지 못했습니다. 누군가 내 코드에서 오류의 위치를 설명 할 수 있습니까? 지도에 점수를 어떻게 추가 할 수 있습니까?
나는 이것을했다. 나의 코드는 이제 위의 (변경된 내용으로 편집 한) 것처럼 보이지만 나는 아직도 빈 페이지를 얻고있다. –
저에게 다시 연락 할 수 있습니까? –