Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

138
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda