addAnnotation method

void addAnnotation(
  1. Annotation annotation
)

Adds an annotation to the graph.

Annotations are visual elements like sticky notes, markers, or group containers that provide additional context to the graph.

Triggers the onAnnotationCreated callback after successful addition.

Parameters:

  • annotation: The annotation to add

See also:

  • createStickyNote for creating sticky note annotations
  • createGroupAnnotation for creating group annotations
  • createMarker for creating marker annotations

Implementation

void addAnnotation(Annotation annotation) {
  annotations.addAnnotation(annotation);
  // Fire callback after successful addition
  callbacks.onAnnotationCreated?.call(annotation);
}