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

160
Views
D3: visualización de mapas geográficos: no se puede obtener nada en la página localHost

Estoy siguiendo el tutorial en el libro D3 de Scott Murray. Tengo el siguiente script de código HTML/JS/D3 del libro:

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>D3: Loading GeoJSON data and generating SVG paths</title> <script type="text/javascript" src="../d3.js"></script> <style type="text/css"> /* No style rules here yet */ </style> </head> <body> <script type="text/javascript"> //Width and height var w = 500; var h = 300; //Define path generator, using the Albers USA projection var path = d3.geoPath() .projection(d3.geoAlbersUsa()); //Create SVG element var svg = d3.select("body") .append("svg") .attr("width", w) .attr("height", h); //Load in GeoJSON data d3.json("us-states.json", function(json) { //Bind data and create one path per GeoJSON feature svg.selectAll("path") .data(json.features) .enter() .append("path") .attr("d", path); }); </script> </body> </html>

Estoy usando D3 v5. Cuando actualizo mi navegador localhost no veo nada. Tengo un error, pero ese error siempre está ahí, incluso para otros fragmentos de código que funcionan.

ingrese la descripción de la imagen aquí

¿Alguna idea/sugerencia de por qué es esto? ...¿Y como arreglarlo?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

A partir de d3 v5 d3.json() ya no usa funciones de devolución de llamada, sino que debe ser una promesa:
https://github.com/d3/d3/blob/main/CHANGES.md#changes-in-d3-50

about 4 years ago · Juan Pablo Isaza Report
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!