Reputation: 13
I have a requirement that in case of an example like
I want the two r1s to appear independently on their respective axis I.e
I want something like
l1 - r1
l3 - r1
l2 - r2
r1 - r3
i.e the 2 r1s should exist independently on the correct sides I.e the ‘from and’to’sides depending on their position in the array of data say having keys [‘from’ ,’to’, ‘weight’
I do not want
L1 - r1 - r3
Upvotes: 1
Views: 832
Reputation: 12717
Use distinct values in the data
object, and then use the nodes
object to make their names (and optionally colors) the same.
Highcharts.chart('container', {
title: {
text: 'Highcharts Sankey Diagram'
},
series: [{
keys: ['from', 'to', 'weight', 'id'],
data: [{
from: 'L1',
to: 'R1',
weight: 5
},
{
from: 'L3',
to: 'R1',
weight: 1
},
{
from: 'L2',
to: 'R2',
weight: 1
},
{
from: 'L4',
to: 'R3',
weight: 1
},
],
nodes: [{
id: 'L4',
name: 'R1',
color: '#000'
},
{
id: 'R1',
name: 'R1',
color: '#000'
}
],
type: 'sankey',
name: 'Sankey demo series'
}]
});
https://jsfiddle.net/kLx2n7mz/12/
Note, you wouldn't need to include id:'R1'
in the nodes
object if you didn't want to assure they have the same color.
Upvotes: 2