Annotation

Type class

A plugin which automatically groups PercenSeries slices that are smaller than certain percent into one "Other" slice.

By pushing an instance of Annnotation into plugin list of any Chart, it automatically applies the functionality.

Example:

let annotation = chart.plugins.push(new am4plugins_annotation.Annotation());
let annotation = chart.plugins.push(new am4plugins_annotation.Annotation());
{
  "plugins": [{
    "type": "Annotation"
  }]
}

@since 4.5.5

@todo resolve translations
@todo change mouse cursors based on context/tool
@todo better line selection on click
@todo arrow support
@todo undo/redo
@todo reposition/resize annotations on chart resize
@todo make annotations hold on IE (when in not annotation mode)

Sources

This information about Annotation is provided for reference only and is not available through exported packages and thus should not be imported or used on its own.

Inheritance

Annotation extends Plugin.

Annotation is not extended by any other symbol.

Properties

active
#

Type boolean

Default false

Seting to true puts the chart in annotation mode.

Setting to false returns chart to regular mode of operation.

autoSize
#

Type boolean

Default false

If set to true plugin will try to reposition annotation relatively when size of the chart chanages.

This feature is experimental. Use at your own risk.

@since 4.7.19

colors
#

Type Array < Color >

List of colors to show in selection.

currentColor
#

Type Color

Default #000

Currently selected color.

currentFontSize
#

Type number

Default 10

Currently selected font size.

currentFontWeight
#

Type number

Default 400

Currently selected font weight.

currentOpacity
#

Type number

Default 1

Currently selected opacity.

currentTool
#

Type string

Default select

Currently selected tool.

currentWidth
#

Type number

Default 1

Currently selected width.

data
#

Type any

Set or get annotation data.

@since 4.5.6

fabric
#

Type Canvas

Returns an instance of Fabric's Canvas.

fontSizes
#

Type Array < number >

List of available font sizes.

fontWeights
#

Type Array < number >

List of available font weights.

group
#

Type SVGGElement

A <g> that holds SVG representation of the annotations in chart overlay.

icons
#

Type Array < string >

Default []

List of icons to use in annotation

indicator
#

Type HTMLElement

Current tool/color indicator element.

opacities
#

Type Array < number >

List of opacities available for selection.

target
#

Type Optional < Sprite >

Inherited from Plugin

A target object plugin is for.

useMenu
#

Type boolean

Default true

If set to false the plugin will not create own menu nor will add its items to existing Export menu.

In such case, annotation functionality will be available only via API.

@since 4.8.0

widths
#

Type Array < number >

List of widths in pixels for line and free-draw tool.

There is 1 inherited item currently hidden from this list.

Methods

activate()

#

Returns void

Activates annotation mode.

addIcon(

url: string

)

#

Returns void

Adds an image to canvas.

addText()

#

Returns void

Adds an editable text object to canvas.

arrow()

#

Returns void

Puts annotator in arrow drawing mode.

clear()

#

Returns void

Clears all annotations.

constructor()

#

Returns Annotation

Constructor

deactivate()

#

Returns void

Deactivates annotation mode.

delete()

#

Returns void

Puts annotator in object deletion mode

deleteSelected()

#

Returns void

Deletes selected objects

discard()

#

Returns void

Clears all annotations and exits annotation mode.

dispose()

#

Returns void

Inherited from Plugin

Disposes this object and related stuff.

draw()

#

Returns void

Puts annotator in free-drawing mode.

init()

#

Returns void

isDisposed()

#

Returns boolean

Inherited from Plugin

Returns if this element is already disposed.

line()

#

Returns void

Puts annotator in line drawing mode.

select()

#

Returns void

Puts annotator in object selection mode.

setColor(

value: Color

)

#

Returns void

Sets color.

setFontSize(

value: number

)

#

Returns void

Sets font size.

setFontWeight(

value: number

)

#

Returns void

Sets font weight.

setIconFill(

img: Image

)

#

Returns void

Attemps to set a fill to the SVG icon.

setOpacity(

value: number

)

#

Returns void

Sets opacity.

setWidth(

value: number

)

#

Returns void

Sets line width.

underConstruction()

#

Returns void

Does nothing.

There are 2 inherited items currently hidden from this list.

Events

Annotation does not have any events.

Adapters

Annotation does not have any adapters.