多个entry同名时绘制sankey

Draw sankey when multiple entries have the same name

在从同名子节点形成新节点时,我无法从中形成新节点。它不是从子节点形成一个节点,而是从 start 创建一个新节点 我读了一些关于名称冲突的文章,但我仍然无法找到解决方案

在我的例子中,我有两个节点 cricketsports 具有相同的子节点 others.因此,它应该独立对待具有相同名称的多个条目

Highcharts.chart('container', {

    title: {
        text: ''
    },
    xAxis: {
        type: 'pre-instituion, and trail phase'
    },

    series: [{
        keys: ['from', 'to', 'weight', 'tooltip'],
        data:  [
                ['Apple', 'sports', 34],
                ['sports', 'cricket', 15],
                ['sports', 'footbal', 10],
                ['sports', 'basketball', 1],
                ['sports', 'Others', 1],
                ['cricket', 'sachin', 15],
                ['cricket', 'Others', 15],

                ['Google', 'sports', 24],
                ['sports', 'cricket', 15],
                ['sports', 'footbal', 20],
                ['sports', 'basketball', 1],
                ['sports', 'Others', 1],
                ['Alphabet', 'sports', 24],
                ['sports', 'cricket', 15],
                ['sports', 'footbal', 20],
                ['sports', 'basketball', 1],
                ['sports', 'Others', 1]
              ],
        type: 'sankey'


    }]

});

这是sankey link

您需要在 data 中使用不同的值并使用 nodes 以任何方式格式化名称:

series: [{
    nodes: [{
        id: 'Others-l3',
        name: 'Others'
    }],
    ...
}]

现场演示: https://jsfiddle.net/BlackLabel/oqbtg94k/

API参考:https://api.highcharts.com/highcharts/series.sankey.nodes