首页 > 解决方案 > 当我们有源数据并且在 highcharts 和 d3.js 中尝试匹配目标数据时,sankey 图表没有绘制

问题描述

我在 D3.js 中绘制了 sankey 图表并在 highcharts 中进行了尝试,当源和目标中的数据相同时,图表没有绘制。如何克服这个限制。

    var graph = {
    "links": [
              {"source":"1","target":"1","value":"1.7"},
              {"source":"1","target":"2","value":"1.5"},
              {"source":"2","target":"3","value":"1.2"},
              {"source":"3","target":"4","value":"0.3"}
    ] ,
    "nodes": [
              {"name":"Energy"},
              {"name":"Industrial Processes"},
              {"name":"Electricity and heat"},
              {"name":"Electricity"}
    ] }

我在高图表中尝试过。当数据类似时我发现了同样的问题

    series: [{
    keys: ['from', 'to', 'weight'],
    data: [{
    from: 'total',
    to: 'Useful kinetic energy',
    weight: 56,
    outgoing: true
    }, {
        from: 'total',
        to: 'total',
        weight: 27,
        outgoing: true
    }, {
        from: 'total',
        to: 'Sound loss',
        weight: 17,
        outgoing: true
    }]

请建议我如何克服这个问题,即当我们在源和目标中有相同的数据时

标签: javascriptd3.jshighcharts

解决方案


推荐阅读