AG Studio Launch Week 🚀🚀🚀 28 Sep - 2 Oct 2026 🚀🚀🚀 Join now

JavaScript ChartsAnnotations

Version 14.2.0
Enterprise

To improve data analysis, a range of annotations can be added to Cartesian charts. These annotations are especially useful for highlighting trends and key data points.

In the example above:

  • Select annotations from the toolbar and click on the series area to add them.
  • Use the floating options toolbar to adjust the position, colour, or style.
  • Add labels or extend lines using the options available from the 'Settings' button.
  • Delete annotations via the main toolbar (to delete all), or the floating toolbar (to delete individually).

Annotation Types Copy Link

A subset of annotation types is available across all Cartesian charts, including:

  • Text Annotations: text, comment, callout and note.
  • Lines: line, horizontal-line and vertical-line.
    For charts with a vertical Number Axes, the parallel-channel and disjoint-channel are also available.
  • Arrows: arrow, arrow-up and arrow-down.

For more details about these, and for the full set of annotations, see Financial Charts.

Toolbar Copy Link

The Annotations Toolbar offers menu options for annotating charts and is enabled by default. Use toolbar.enabled: false to disable.

The menu items in the toolbar can be customised by configuring the toolbar.buttons options array.

{
    annotations: {
        enabled: true,
        toolbar: {
            buttons: [
                {
                    icon: 'delete',
                    value: 'clear',
                },
                {
                    icon: 'text-annotation',
                    value: 'text-menu',
                },
            ],
        },
    },
}

In the above example:

  • Only the Text Annotations and Delete button are available.
  • The order of these is switched.

Keyboard Shortcuts Copy Link

The following keyboard shortcuts can be used.

  • ^ Ctrl⌘ Command+Z will undo any drawing and annotation actions.
  • ^ Ctrl⌘ Command+Y will redo any undo actions.
  • ^ Ctrl⌘ Command+C will copy the selected drawing or annotation.
  • ^ Ctrl⌘ Command+V will paste the copied drawing or annotation.
  • Delete or ⌫ Backspace will delete the selected item.
  • Arrow keys ( ) will move the selected drawing or annotation by 1 pixel.
    Use in combination with ^ Ctrl⌘ Command or ⇧ Shift to move by 10 pixels.
  • Holding down ⇧ Shift whilst creating a drawing or dragging a handle will snap it to the nearest 45° angle.

Save & Restore Copy Link

Drawings and Annotations can be saved, restored and programmatically initialised and modified, using the Chart State API.

Read Only Copy Link

Drawings and annotations can be made read only by setting the readOnly property to true for the relevant items in the annotations array using the Chart State API. This prevents end users from selecting, editing, or deleting those annotations.

Customisation Copy Link

To customise the initial look of Drawings and Annotations, use Theme Override Options.

{
    theme: {
        overrides: {
            common: {
                annotations: {
                    line: {
                        stroke: 'lime',
                        strokeWidth: 3,
                        lineDash: [3, 4],
                    },
                    'parallel-channel': {
                        stroke: 'red',
                        strokeWidth: 4,
                        background: {
                            fill: 'red',
                        },
                        middle: {
                            strokeOpacity: 0,
                        },
                    },
                    comment: {
                        fill: 'orange',
                        color: 'blue',
                        stroke: 'blue',
                        strokeWidth: 2,
                    },
                },
            },
        },
    },
}

API Reference Copy Link

Properties available on the AgAnnotationsOptions interface.

axesButtons AgAnnotationAxesButtons
The options for the axes buttons
toolbar AgAnnotationsToolbar
Configuration for the toolbar for creating annotations.
optionsToolbar AgAnnotationOptionsToolbar
Configuration for the options toolbar for editing an annotation.
enabled boolean
Whether the associated elements and properties should be used in the chart.