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

101
Views
I cannot enlarge my map with D3.js and always get a black block

I try to enlarge my map with geoProjection or geoMercator. The mapsvg is hidden befind a black block, and my map cannot be seen. My code is as follows:

fetch("./data/chinaMapDataAll.json")
  .then(d1 => d1.json())
  .then(d1 => {
    var mapdata = [];
    var mapsvg = d3.select("#mapsvg")
    var mapwidth = mapsvg.attr("width")
    var mapheight = mapsvg.attr("height")
    for(let i=0;i<=d1.features.length-1;i++){
      mapdata.push(d1.features[i].geometry.coordinates[0][0]);
    }
    console.log(mapdata);
    var mapProjection=d3.geoProjection(function(x,y){
      return [x,y];
    });    
    var mapPath = d3.geoPath(mapProjection);                           
    mapsvg.selectAll("path")
      .data(d1.features)
      .join("path")
      .attr("d", function(d) { return  mapPath(d) })      
      .attr("fill",function(d,i) { return scacolor[i]; })
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!