Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Legend #6501

Open
RackweLLizm opened this issue Nov 11, 2024 · 5 comments
Open

Static Legend #6501

RackweLLizm opened this issue Nov 11, 2024 · 5 comments

Comments

@RackweLLizm
Copy link

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
Copy link
Author

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
Copy link
Contributor

Aarebecca commented Nov 11, 2024

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
Copy link
Author

@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
Copy link
Contributor

@RackweLLizm Maybe you can customize a legend plugin yourself

@VadimirOrlov
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants