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

132
Vistas
How to give a fixed height to a d3js sankey chart left side nodes

I am working in this d3 sankey chart where I wanted to give a fixed height to left side node inorder to align sankey chart with donut chart. The Green line represents separation between two charts and I need to fix the height of node next to donut chart enter image description here

let data =
    {
      "links": [
        { "source": "Agriculture", "target": "Rice Cultivation", "value": "120" },
        { "source": "Agriculture", "target": "Deforestation", "value": "30" },
        { "source": "Agriculture", "target": "Coal Mining", "value": "30" },
        { "source": "Chemicals", "target": "HFCs - PFCs", "value": "100" },
        { "source": "Chemicals", "target": "HFCs - PFCs", "value": "50" }
],

"nodes":[

        { "name": "Agriculture" },
        { "name": "Chemicals" }
]
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Process your data convert all values into % Ex: For Agriculture you have 120, 30, 30, total will be 180. Now, change values to % by dividing 120/180, 30/180, 30/180. Hence agriculture will be 100% when you sum it's targets

Repeat for all the groups you have, so your source should be equal to 100% when sum up, so heights of your source (left nodes) will be equal

let data = {
      "links": [
        { "source": "Agriculture", "target": "Rice Cultivation", "value": "66.67" },
        { "source": "Agriculture", "target": "Deforestation", "value": "16.67" },
        { "source": "Agriculture", "target": "Coal Mining", "value": "16.67" },
        { "source": "Chemicals", "target": "HFCs - PFCs", "value": "66.67" },
        { "source": "Chemicals", "target": "HFCs - PFCs", "value": "33.33" }
    ],
    "nodes":[
        { "name": "Agriculture" },
        { "name": "Chemicals" }
    ]
}

I hope u find it helpful, Thanks

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