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

137
Views
Mejor comprensión de 'd' en d3.js con un ejemplo

Estoy siguiendo este ejemplo en d3.js sobre cómo hacer un mapa de coropletas pequeño-múltiple:

https://gist.github.com/armollica/6314f45890bcaaa45c808b5d2b0c602f

Hay esta función contenedora:

 function ready(error, us, manufacturing) {}

Y dentro de él, hay:

 function render(d) { var data = d.values; //this is the manufacturing data var context = d3.select(this).node().getContext("2d"); var color = function(d) { console.log(d) //this is the 'US' geography json data if (data.has(d.id)) { var value = data.get(d.id).pct_change_emp; return value ? colorScale(value) : "#fff"; } return "#fff"; }; // Want the maps to render sequentially. Use setTimeout to give the // browser a break in between drawing each map. window.setTimeout(function() { drawMap(context, color); }, 500); }

No entiendo cómo la función de representación accede a dos conjuntos de datos diferentes usando la misma variable d . Los data de registro de consola son los datos de fabricación, pero los datos de registro de d debajo de la declaración de var color son los datos geo-json de EE. UU.

No veo cómo d está devolviendo diferentes conjuntos de datos aquí, y dónde ocurre esa especificación en el código. Todo funciona funcionalmente, simplemente no lo entiendo.

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!