Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
d3.js is rendering black rectangle instead of map

I'm trying to draw choropleth map of Seoul but it just gives me only a black rectangle.
I thought there might be a problem with projection.scale but I couldn't figure it out.
I used scale.fitSize() function to handle it. but my d3 is older version that not available of fitSize().

my code is here:

var width = 600, height = 700;

var svg = d3.select('#chart').append('svg')
    .attr('width',width)
    .attr('height',height);

var projection = d3.geo.mercator()
    .center([128,36])
    .scale(5000)
    .translate([width/2, height/2]);

var path = d3.geo.path()
    .projection(projection);



d3.json('Seoulmap.json',function(error,data) {
    var features = topojson.feature(data, data.objects['Seoulmap']).features;
    svg.selectAll('path')
        .data(features)
      .enter().append('path')
        .attr('class','name')
        .attr('d',path)
        .attr('id',function(d) { return d.properties.ADM_DR_NM; });
});

How my code is rendering black rectangle: enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!