antvis / G6

♾ A Graph Visualization Framework in JavaScript.
https://g6.antv.antgroup.com/
MIT License
11.15k stars 1.33k forks source link

Static Legend #6501

Open RackweLLizm opened 1 week ago

RackweLLizm commented 1 week ago

Describe the bug / 问题描述

Legend moves with mouse movements. This disrupts visual clarity on a crowded canvas. What I want is for Legend to be static at the top right and not move. Even if you don't plan on providing this feature, can you give me an idea on how it can be done by intervening in the source code?

The changes I made to Legend.js didn't work.

return { display: 'flex', flexDirection, justifyContent, alignItems,

position: 'absolute', top: 0, right: 0, };

Reproduction link / 重现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome

Additional context / 补充说明

No response

RackweLLizm commented 1 week ago

Another thing I want to ask is can we assign colors to Legends? That is, let the legend color scheme be created according to the color I assign to the node. Like nodeStyle {color:"red"}.

Aarebecca commented 1 week ago

The first issue you mentioned will be fixed in the near future. Generally speaking, the legend represents a category of node, so you cannot change it by specifying the color of a single piece of data.

RackweLLizm commented 1 week ago

@Aarebecca It's nice to know that the first problem will be solved, thank you in advance. The feature I wanted was in graphin. I could assign color according to nodeType:x nodeType:y nodeType. Actually, I'm looking for a feature similar to this.

Aarebecca commented 1 week ago

@RackweLLizm Maybe you can customize a legend plugin yourself

VadimirOrlov commented 1 week ago

legend1.ts.zip This is unfinished sample how legend can be modified to use it's own Canvas the way how it's done for minimap plugin