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

122
Views
Encuentre una fecha intermedia entre dos fechas en D3.js

Estoy usando un diagrama de dispersión D3.js para mostrar la cantidad de trabajos según los períodos de tiempo. Me gustaría colocar puntos en la fecha intermedia entre las fechas de inicio y finalización de cada período. Los datos que tengo se ven así:

 period, amount, startDate, endDate 1, 5, 26/11/1982, 2/6/1989 2, 6, 2/6/1989,2/1/1990 3, 11, 2/01/1990,20/6/1999

Intenté mapear puntos en el gráfico usando:

 .attr("cx", function(d) { return xScale(new Date(d.endDate)) - xScale(new Date(d.startDate)) * 0.5 })

Pero esto no funciona. ¿Qué me estoy perdiendo?

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

0

El punto medio entre dos puntos dados es:

 middleX = (x1 + x2) / 2;

En tu caso:

 d => { const xFrom = xScale(new Date(d.startDate)); const xTo = xScale(new Date(d.endDate)); return (xFrom + xTo) / 2; }
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!