Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

114
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda