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

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

Open
cd-alexslater-old opened this issue Jan 4, 2023 · 3 comments
Open
Assignees

Comments

@cd-alexslater-old
Copy link

cd-alexslater-old commented Jan 4, 2023

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?

@pearmini
Copy link
Member

pearmini commented Jan 5, 2023

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.

@cd-alexslater-old
Copy link
Author

@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:
image

@pearmini
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: No status
Development

No branches or pull requests

3 participants