I'm trying to create a dynamic Sankey diagram with echarts. I have a case where I have a lot of data and my diagram is not really readable as you can see in the image (I have hidden the node names for privacy reasons).

Here are my options :
var option = {
tooltip: {
trigger: 'item',
triggerOn: 'mousemove',
formatter: function (params) {
if (params.dataType === 'edge') {
return `${params.data.color}<br>${params.data.source} --> ${params.data.target} : <b>${formatNumber(params.data.trueValue, formatLocale(lang))}</b>`;
}
else {
return `${params.data.tooltip_text}`;
}
}
},
legend: {},
backgroundColor: '{{backgroundColor}}',
dataZoom: [
{
type: 'slider',
show: true,
}
],
series: {
type: 'sankey',
layout: 'none',
layoutIterations: 0,
nodeGap: 8,
nodeWidth: 20,
labelLayout: {
hideOverlap: true
},
emphasis: {
focus: 'adjacency'
},
lineStyle: {
color: 'gradient',
curveness: 0.4
},
label: {
show: false,
position: 'right',
distance: 10,
},
data : {{{convertJS data}}},
links: {{{convertJS links}}},
}
};
Here are examples of nodes formatting :
[
{
color: 'Inconsistent node',
name: "Electricity meter TD",
parents: [
"Electricity meter 1 D",
"Electricity meter 2 D",
"Photovoltaic electricity meter D"
],
tooltip: 'Inconsistent node<br>Sum of datapoints : 2.636<br>Sum of children : 2,599',
type: 'LT_ELEC',
itemStyle: { color: '#ffb77f' },
tooltip_text: 'Inconsistent node<br>Sum of datapoints : 2.636<br>Sum of children : 2,599'
},
{
color: 'Inconsistent node',
name: "Electricity meter -2 (D)",
parents: [
"Electricity meter 1 D"
],
tooltip: 'Inconsistent node<br>Sum of datapoints : 30.69<br>Sum of children : 1,003',
type: 'LT_ELEC',
itemStyle: { color: '#ffb77f' },
tooltip_text: 'Inconsistent node<br>Sum of datapoints : 30.69<br>Sum of children : 1,003'
},
]
Here are examples of links formatting :
links : [
{
color: 'Electrical flow',
source: "Electricity meter 1 D",
target: "Electricity meter TD",
value: 100,
lineStyle: { color: '#d8db14', opacity: 0.5 },
trueValue: 0
},
{
color: 'Electrical flow',
source: "Electricity meter 1 D",
target: 'Electricity meter -2 (D)',
value: 190.66666666666669,
lineStyle: { color: '#d8db14', opacity: 0.5 },
trueValue: 90.66666666666667
}
]
You should also know that I sorted my nodes by type.
Does anyone know what I could do to improve the rendering? Because some nodes only have one type of link so they could be placed elsewhere. Here is an example of a change that would make the diagram more readable (I made this example by dragging the nodes).
