Interface: AnnotatedText<ANNOTATION>
@ghentcdh/annotated-text / AnnotatedText
Interface: AnnotatedText<ANNOTATION>
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:11
Create annotation is a factory function that creates an annotation model. Use this model to manage annotations and text, every change related to the visualization should be done through this function.
Type Parameters
ANNOTATION
ANNOTATION
Properties
addAnnotation()
addAnnotation: (
annotation
) =>this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:31
Add a single annotation to the model. If you update the complete list of annotations, on a large set than it can start hanging. If the annotation with this id already exists, it will update the annotation.
Parameters
annotation
ANNOTATION
Returns
this
deleteAnnotation()
deleteAnnotation: (
id
) =>this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:44
Delete an existing annotation in the model.
Parameters
id
string
| number
Returns
this
destroy()
destroy: () =>
this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:71
Destroy the annotation model and all associated resources. Important: this will remove all event listeners and the SVG element from the DOM.
Returns
this
highlightAnnotations()
highlightAnnotations: (
ids
) =>this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:50
Highlight annotations by their IDs.
Parameters
ids
(string
| number
)[]
Returns
this
on()
on: (
event
,callback
) =>this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:61
Register an event listener for the annotation model.
Parameters
event
EventListenerType
callback
Returns
this
onError()
onError: (
callback
) =>this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:66
Register an error callback that will be called when an error occurs in the annotation model.
Parameters
callback
Returns
this
scrollToAnnotation()
scrollToAnnotation: (
id
) =>this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:97
Scroll to the annotation with the given ID.
Parameters
id
string
| number
Returns
this
selectAnnotations()
selectAnnotations: (
ids
) =>this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:55
A list of selected annotations, if this is handled outside the model,
Parameters
ids
(string
| number
)[]
Returns
this
setAnnotations()
setAnnotations: (
annotations
,redraw?
) =>this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:23
Set the annotations for the model. The adapter will parse the annotations to the internal model
Parameters
annotations
ANNOTATION
[]
redraw?
boolean
If true, the annotations will be redrawn.
Returns
this
setText()
setText: (
text
,redraw?
) =>this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:17
Set the text for the model. The adapter will parse the text to the internal model.
Parameters
text
string
redraw?
boolean
Returns
this
updateAnnotation()
updateAnnotation: (
id
,annotation
) =>this
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:38
Update an existing annotation in the model. If the annotation with this id does not exist, it will add the annotation.
Parameters
id
string
| number
annotation
ANNOTATION
Returns
this
Methods
changeAnnotationAdapterConfig()
changeAnnotationAdapterConfig<
KEY
>(key
,value
):AnnotatedText
<ANNOTATION
>
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:87
Type Parameters
KEY
KEY
extends keyof AnnotationAdapter
<unknown
>
Parameters
key
KEY
value
Returns
AnnotatedText
<ANNOTATION
>
changeTextAdapterConfig()
changeTextAdapterConfig<
KEY
>(key
,value
):AnnotatedText
<ANNOTATION
>
Defined in: libs/core/src/lib/compute/create/CreateAnnotations.model.ts:78
Change the configuration of the textAdapter. If needed, it will recreate the annotation model.
Type Parameters
KEY
KEY
extends keyof TextAdapter
Parameters
key
KEY
value
TEXT_CONFIG_VALUES
<KEY
>
Returns
AnnotatedText
<ANNOTATION
>