antvis/G2

Do you want to work on this issue?

You can request for a bounty in order to promote it!

[Seeking Guidance, v4/v5] - Automatic Placement of Annotations #4548

cd-alexslater-old posted onGitHub

Is there any automatic placement strategies built into G2 to keep annotations from overlapping with marks / other annotations? I'm evaluating whether or not we will have to write something ourselves to be able to keep the automatically annotated graphs clean.

E.g. if I have four annotations, and I say that they all point at one particular point, is there any sort of placement / automatic adjustment feature built into G2 that would allow the annotations to be positioned without overlapping?

If not is this something that would be considered for the future / is there any placement strategies or algorithms you would recommend to implement this myself?


Can you give me a concrete example? I'm not sure I'm understanding it correctly. A chart that is currently plotted and the result that you expected will be very helpful.

posted by pearmini over 2 years ago

@pearmini Yes - so this is what happens now if you plot multiple datamarker annotations for the same point: image This is what they could look like if G2 had the ability to place them automatically: image

Basically, I was wondering if there was any functionality for G2 to prevent overlapping of annotations without me having to manually use offsets and positioning. This would make annotations dynamic with the graph, so that you can initialize a large number of annotations, and they reposition themselves so that they don't overlap with other graph elements.

My use case for this would be to dynamically generate graphs with multiple custom HTML annotations. It will look something like this when I'm done: <img width="208" alt="image" src="https://user-images.githubusercontent.com/114569661/211324924-2255966f-0a8e-4aeb-a8a6-5372caaa5318.png">

posted by cd-alexslater over 2 years ago

This feature definitely would be considered for the future in v5. Actually, it already has implemented some placement strategies for the label specified by label.transform. You can try this example for details. After releasing the stable version, the annotation will also support such transform to avoid overlap.

posted by pearmini over 2 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests