antvis/G6

Static Legend #6501

RackweLLizm posted onGitHub

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, };

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


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"}.

posted by RackweLLizm 5 months 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.

posted by Aarebecca 5 months 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.

posted by RackweLLizm 5 months ago

@RackweLLizm Maybe you can customize a legend plugin yourself

posted by Aarebecca 5 months 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

posted by VadimirOrlov 5 months ago

The legend won't be scaled or translated by the camera in the latest version.

posted by Aarebecca 5 months ago

Fund this Issue

$0.00
Funded

Pull requests