echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] legend in Sankey

Open Frominor opened this issue 1 year ago • 3 comments

Version

5.2.2

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?code=CYQwLiAEC8kNoChKQN5OZAdiAtgUwC5IByEYgGnWQGNw8BzAewCcBPI4gRmPQF9LkaDFlyESAIwpVItMAxbsS3PgNTTs-DiG6qadJmw4AmHsn7ohGDWNIndM_Qo7Kzqy8msdxO6bPmGSAGZTSHNBdVEOailhPwNFLhDeBABdAG4EPGB6PABnGHgLaVzGAFdmahsyewhmHLAtH2EANxAAG1KxAFZ7OKcSahMVIuES8sqtGIxa-q07aVaOsUDexwDiahdQt2KyiptJGpA6vAaJJoxFzqIADlW5eKih1xGMMf3Jo5Oz4m8p5Cuy3u_gSmySO1Gewm53-kBmp0asMBRE4wMeA2Cw3CkPGBwuyHhP2i9mRkCMaP6Gy2yXSCAQjAADmAAJaMTAFSxtBh4TDAIgoMKQXJ4ZjMvL86RgVgMmy5ECYADWeFYsLaIFYZR-mDZeFhnhIuQVsLwOAZAAsQLlmbl-ZAAGaMailG0kEDAABWIEqmGoKu2dOEoAg9iyOVy9mFXOocmAAFlGMAbDhSm0WQyubDI3ho7a2szMHgAMpSrm26iMNosDjMLLEUL-l7IejMEDm5nUIiIYTuabSmzNsoM2HIUX0M1nABsAAZ7ATGUQZ9IaGbmW1gDXMJ2lxge8ICX3q9mwMO9wAvLnNPBtIgAFlne9yFpltrNeGZY7ORnJkAA7szgGAZpEIE37MEQXQNnuowlmIKD2qu14kAy-ZGpBUEEngAAeYAAMJsnImBnLu6Hnngl6IXe25QbkMG2nI2FRDo9r4YWzKnmInATuQ8FtIhvxqtQqHJOhGCCiJ9G4WydrvraDKMFaLJshw-ZWomdZiehbLUHmglEHapQ-op7IABQMgAlGoInCG0CoFHAtJWRgoZ5AAdA6zAAKJemaxnGZh3HMhZ0AAHyWY5GDMnakB-S5fRsDA0CwFSxAWTZLkMs6PmBRk4WhGZOXhTgrA4RazBgC5wDWgy4DUGaACC0aspgxnEeJB4kGAjD0PQXKFleR4niJQYgAAkryWFEDZ95DeAIAACrtcQzkhI5vD5VRokbcJe4pNI227bwaRAA

Steps to Reproduce

data = [ { name: 'a', category: 'Category 1' }, { name: 'b', category: 'Category 1' }, { name: 'a1', category: 'Category 2' }, { name: 'a2', category: 'Category 1' }, { name: 'b1', category: 'Category 3' }, { name: 'c', category: 'Category 1' }, ];

edges = [ { source: 'a', target: 'a1', value: 5 }, { source: 'a', target: 'a2', value: 3 }, { source: 'b', target: 'b1', value: 8 }, { source: 'a', target: 'b1', value: 3 }, { source: 'b1', target: 'a1', value: 1 }, { source: 'b1', target: 'c', value: 2 }, ];

option = { tooltip: { trigger: 'item', triggerOn: 'mousemove', }, legend: { show: true, data: ['Category 1', 'Category 2', 'Category 3'], selectedMode: 'multiple', top: 'top', }, series: [ { type: 'sankey', layout: 'none', data: data, links: edges, categories: [ { name: 'Категория 1', itemStyle: { color: '#5470c6' } }, { name: 'Категория 2', itemStyle: { color: '#91cc75' } }, { name: 'Категория 3', itemStyle: { color: '#fac858' } }, ], emphasis: { focus: 'adjacency' }, }, ], };

Current Behavior

I am using a Sankey diagram. I need to be able to customize the legend so that when clicked, the steps associated with it will disappear

Expected Behavior

the legend must show

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

Frominor avatar Dec 17 '24 22:12 Frominor

not-a-bug, this is a how-to question:

when clicked, the steps associated with it will disappear

In graphic.onclick, instead of toggleSelect action, remove the selected edges and call setOption(option).

helgasoft avatar Dec 18 '24 17:12 helgasoft

@helgasoft,сan you write in more detail what I need to do?. I'm trying to do something very similar to this - https://app.amplitude.com/analytics/demo/chart/new/mpq19jv9. I need to show a lot of labels and when clicked hide the clicked step and all that go from it

Frominor avatar Dec 19 '24 09:12 Frominor

🚩 Please follow Official posting guidelines:


The issue list is reserved exclusively for bug reports and feature requests. For usage questions, please use the following resources:


helgasoft avatar Dec 19 '24 17:12 helgasoft