세부 사항 :
다음과 같은 설정이 있습니다. 생성 된 사용자 정의 topjson 파일은 단순히 내 웹 페이지에 표시하려고합니다. 내가 콘솔에서 볼 수있는 생성 된 및 데이터가 올바르게로드 된 있지만 d3 어떤 경로 요소 렌더링 및 아무것도 표시됩니다.D3의 GeoJSON : 경로가 데이터에 바인딩되지 않음
자바 스크립트
var width = 960;
var height = 500;
var svg = d3.select('body').append('svg')
.attr('width', width)
.attr('height', height);
var projection = d3.geo.albersUsa()
.scale(1000)
.translate([width/2, height/2]);
var path = d3.geo.path()
.projection(projection);
d3.json('http://localhost.com/calgary.json', function(error, calgary) {
svg.append('path')
.datum(topojson.feature(calgary))
.attr('d', path)
.attr('fill','red');
});
사용자 정의 Topojson 파일 :
의 종속은 :
첫째 : 나를 위해
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script>
콘솔에 오류가 있습니까? – elias