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

226
Visualizações
Change aspect of highcharts sankey chart

I need to build a sankey chart from highcharts.js to look like the one in the example image, basically what I try to do is change the shape and position of some flows and nodes in the chart. Help will be apreciated since I cant find any solucion in the internet.

Highcharts.chart('container', {...});

codepen sankey code

sankey exemple image

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Here is an ugly hack that can do what you need. I had no time to properly finish it, but it works.

What you can do now, is to set the node incoming and outgoing options and play with vertical-horizontal-offset.

nodes=[
{id:'import'    ,column:1, offsetVertical:-100 ,offsetHorizontal:-20},
{id:'production',column:0, offsetVertical:22 ,offsetHorizontal:0},
{id:'total'     ,column:2, offsetVertical:0 ,offsetHorizontal:0},
{id:'loss'      ,column:3, offsetVertical:50 ,offsetHorizontal:0},
{id:'final'     ,column:5, offsetVertical:-10 ,offsetHorizontal:0},
{id:'export'    ,column:4, offsetVertical:50 ,offsetHorizontal:0},

]

Highcharts.chart('container', {
  chart: {
    height: (9/16 * 90 )+ "%"
  },
  series: [{
    keys: ['from', 'to', 'weight'],
    data: [{
      from: 'import',
      to: 'total',
      weight: 80,
      incoming: true
    }, {
      from: 'production',
      to: 'total',
      weight: 20,
    }, {
      from: 'total',
      to: 'final',
      weight: 56,
    }, {
      from: 'total',
      to: 'export',
      weight: 17,
      outgoing: true
    }, {
      from: 'total',
      to: 'loss',
      weight: 27,
      outgoing: true
    }],
    dataLabels: {
      nodeFormat: '{point.name}: {point.sum}%',
      padding: 20,
      style: {
        fontSize: '0.8em'
      }
    },
    nodes: nodes,
    type: 'sankey',
    name: 'Energy',
    linkOpacity: 1,
  }]

});

Here is the fiddle link

I changed sankey.js directly and also used the proto translate option. Main changes:

  • Redraw the SVG path for all, except the circular link
  • Replace the SVG path fill with the stroke-width
  • Top justify nodes instead of center
about 4 years ago · Juan Pablo Isaza Relatório

0

Relating to sankey this series have some limitations, to adjust you can use nodeWidth, nodePadding and minLinkWidth.

The nodes are generated so that the total weight going in or out of a node is visualized. Nodes are instances of Point and are available from the series.nodes array. The width of the nodes can be set with the nodeWidth option, and padding between them with nodePadding.

https://www.highcharts.com/docs/chart-and-series-types/sankey-diagram#nodes

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