如何在 Echarts Sankey Diagram 上显示或显示节点值

问题描述

这里是新手,我正在使用 html 绘制桑基图,但在图上显示节点的值时遇到问题。 我使用的代码就像官方示例https://echarts.apache.org/examples/zh/editor.html?c=sankey-energy

JSON 数据在这里https://echarts.apache.org/examples/data/asset/data/energy.json

myChart.showLoading();

$.get(ROOT_PATH + '/data/asset/data/energy.json',函数(数据){ myChart.hideLoading();

myChart.setoption(option = {
    title: {
        text: 'Sankey Diagram'
    },tooltip: {
        trigger: 'item',triggerOn: 'mousemove'
    },series: [
        {
            type: 'sankey',data: data.nodes,links: data.links,focusNodeAdjacency: 'allEdges',itemStyle: {
                borderWidth: 1,borderColor: '#aaa'
            },linestyle: {
                color: 'source',curveness: 0.5
            }
        }
    ]
});

});

我尝试添加

 label: {
        position: "right",distance: 5,formatter: '{b}: {c}'
 }

正如官方教程所说,但它不起作用但显示“未定义”。

enter image description here

那么这是一种显示值的方式吗?谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)