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

Annotation can be used (imported) via one of the following packages.

// Annotation is available in all of the following modules.
// You only need to import one of them.


Inheritance

Annotation extends Plugin.

Annotation is not extended by any other symbol.

Properties

active
#

Type boolean

Seting to true puts the chart in annotation mode.

Setting to false returns chart to regular mode of operation.

@default false

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.

@default false
@since 4.7.19

colors
#

Type Array < Color >

List of colors to show in selection.

currentColor
#

Type Color

Currently selected color.

@default #000

currentFontSize
#

Type number

Currently selected font size.

@default 10

currentFontWeight
#

Type number

Currently selected font weight.

@default 400

currentOpacity
#

Type number

Currently selected opacity.

@default 1

currentTool
#

Type string

Currently selected tool.

@default select

currentWidth
#

Type number

Currently selected width.

@default 1

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

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
@default true

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.