Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda