AnnotationModel
Container class holding all annotations. Annotations have unique IDs and each belongs to a dataset.
Extends
Methods
| Method | Description |
|---|---|
| remove() | Removes an annotation. |
| annotations() | Returns all annotations. |
| updateAnnotationVisibility() | Makes sure annotations are visible in and only in views in which their parent data items are visible. |
| add() | Adds a new annotation, and attaches it to all views. |
| dataAnnotations() | Returns all annotations belonging to the given dataset. |
| onAnnotationAdded() | Fires when an annotation is added. |
| onAnnotationAboutToBeRemoved() | Fires directly before an annotation is removed. |
| onAnnotationEvent() | Fires when an annotation lifecycle event occurs. |
Inherited from ClassHandle
| Method | Description |
|---|---|
| isAliasOf() | Returns true if this handle and other alias the same underlying C++ object. |
| delete() | Releases this JavaScript handle. |
| deleteLater() | Schedules this handle for deferred deletion and returns this handle. |
| isDeleted() | Returns true if this handle has already been deleted. |
| [dispose]() | Releases this handle when the enclosing scope exits, so a handle can be declared with using instead of calling delete() later manually. |
| clone() | Returns a new JavaScript handle aliasing the same underlying C++ object. |
remove()
ts
remove(annotation: Annotation | null): void;Removes an annotation.
Parameters
| Parameter | Type |
|---|---|
annotation | Annotation | null |
Returns
void
annotations()
ts
annotations(): HandleArray<Annotation>;Returns all annotations.
Returns
updateAnnotationVisibility()
ts
updateAnnotationVisibility(): void;Makes sure annotations are visible in and only in views in which their parent data items are visible.
Returns
void
add()
ts
add(type: AnnotationType, data: Data | null): Annotation | null;Adds a new annotation, and attaches it to all views.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | AnnotationType | Type of the annotation |
data | Data | null | The parent dataset |
Returns
Annotation | null
The created annotation or null in case of an error
dataAnnotations()
ts
dataAnnotations(data: Data | null): HandleArray<Annotation>;Returns all annotations belonging to the given dataset.
Parameters
| Parameter | Type |
|---|---|
data | Data | null |
Returns
onAnnotationAdded()
ts
onAnnotationAdded(callback: (annotation: Annotation) => void): () => void;Fires when an annotation is added.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (annotation: Annotation) => void | Called with the added annotation. |
Returns
Unsubscribe function.
() => void
onAnnotationAboutToBeRemoved()
ts
onAnnotationAboutToBeRemoved(callback: (annotation: Annotation) => void): () => void;Fires directly before an annotation is removed.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (annotation: Annotation) => void | Called with the annotation about to be removed. |
Returns
Unsubscribe function.
() => void
onAnnotationEvent()
ts
onAnnotationEvent(callback: (annotation: Annotation, event: AnnotationEvent) => void): () => void;Fires when an annotation lifecycle event occurs.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (annotation: Annotation, event: AnnotationEvent) => void | Called with the annotation and the event type. |
Returns
Unsubscribe function.
() => void