apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.49k stars 19.61k forks source link

[Bug] Sankey chart link tooltip display bug when name is number and layoutIterations = 0 #19132

Open WHU-yang opened 1 year ago

WHU-yang commented 1 year ago

Version

5.4.3

Link to Minimal Reproduction

Reproduction Link

Steps to Reproduce

  1. set this option option = { backgroundColor: '#fff', title: { subtext: 'Data From lisachristina1234 on GitHub', left: 'center' }, series: [ { type: 'sankey', left: 50.0, top: 20.0, right: 150.0, bottom: 25.0, layoutIterations: 0, data: [ { name: 8, depth: 0 }, { name: 0, depth: 0 }, { name: 1, depth: 0 }, { name: 2, depth: 0 }, { name: 3, depth: 0 }, { name: 4, depth: 0 }, { name: 5, depth: 0 }, { name: 6, depth: 0 }, { name: 7, depth: 0 }, { name: 'NaN', depth: 0 }, { name: 'MX', depth: 1 }, { name: '%null%', depth: 1 } ], links: [ { source: 0, target: 'MX', value: 25022831774.549953 }, { source: 1, target: 'MX', value: 28605977083.680016 }, { source: 2, target: 'MX', value: 27272398677.149982 }, { source: 3, target: 'MX', value: 28631976450.510006 }, { source: 4, target: 'MX', value: 26394621518.039997 }, { source: 5, target: 'MX', value: 26287316192.21999 }, { source: 6, target: 'MX', value: 26422745128.80001 }, { source: 7, target: 'MX', value: 27933589408.889965 }, { source: 8, target: 'MX', value: 26772749606.319973 }, { source: 'NaN', target: 'MX', value: 26172117819.829994 }, { source: 0, target: '%null%', value: 15337162719.41 }, { source: 1, target: '%null%', value: 13418581463.959993 }, { source: 2, target: '%null%', value: 12244067423.77 }, { source: 3, target: '%null%', value: 14010210519.840006 }, { source: 4, target: '%null%', value: 13486416685.589994 }, { source: 5, target: '%null%', value: 15089787324.340006 }, { source: 6, target: '%null%', value: 12587004761.710016 }, { source: 7, target: '%null%', value: 13998501597.369995 }, { source: 8, target: '%null%', value: 12562937578.139996 }, { source: 'NaN', target: '%null%', value: 12570863537.480001 } ], lineStyle: { color: 'source', curveness: 0.5 }, itemStyle: { color: '#1f77b4', borderColor: '#1f77b4' }, label: { color: 'rgba(0,0,0,0.7)', fontFamily: 'Arial', fontSize: 10 } } ], tooltip: { trigger: 'item' } };
  2. set layoutIterations = 0

Current Behavior

hover first tooltip should show 0--MX

Expected Behavior

Should show 8 --MX

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

WHU-yang commented 1 year ago

image

helgasoft commented 1 year ago

use data.name of the same type - in your case use character: Replace name:8 with name:'8', name:1 with name:'1', and so on. Then in links replace source:8 with source:'8', etc.

please close issue if problem solved.