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

91
Vistas
Build a d3 tree from a database

I want to draw a tree with d3 where each node is a person. In my database I have a table that correspond to a person and in another table I have the relationship between each persons.

database schema

I don't know how to create the data structure in js that is needed by d3 tree.

I retrieve data in json with this format :

{
    "peoples": [
        {
            "id": 0,
            "first_name": "Louis",
            "last_name": "E",
            "birthdate": "03-31-2000",
            "promo": 4,
            "description": "eczc"
        },
        {
            "id": 1,
            "first_name": "Max",
            "last_name": "D",
            "birthdate": "31-01-1999",
            "promo": 5,
            "description": "dzeczc"
        },
        {
            "id": 2,
            "first_name": "Thomas",
            "last_name": "Z",
            "birthdate": "03-04-2005",
            "promo": 9,
            "description": "edzfc"
        }
    ],
    "relationships": [
        {
            "id": 0,
            "godfather": 1,
            "godson": 0
        },
        {
            "id": 0,
            "godfather": 1,
            "godson": 2
        }

    ]
}

Do you have an hint on how I can do this ?

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