Top
You are looking at an outdated 7.12.0 version of this document. Switch to the 7.14.3 version to see the up to date information.

class anychart.core.annotations.PlotController Improve this Doc

Extends: anychart.core.VisualBase

Plot controller class.

Methods Overview

Specific settings
add()Adds annotation on the plot.
andrewsPitchfork()Creates and returns an Andrews Pitchfork annotation.
cancelDrawing()Cancels current annotation drawing.
ellipse()Creates and returns an Ellipse annotation.
enabled()Disable or enable plot controller.
fibonacciArc()Creates and returns a Fibonacci Arc annotation.
fibonacciFan()Creates and returns a Fibonacci Fan annotation.
fibonacciRetracement()Creates and returns a Fibonacci Retracement annotation.
fibonacciTimezones()Creates and returns a Fibonacci Timezones annotation.
getAnnotationAt()Returns annotation by index.
getAnnotationsCount()Returns annotations count.
getSelectedAnnotation()Returns currently selected annotation.
horizontalLine()Creates and returns a Horizontal Line annotation.
infiniteLine()Creates and returns an Infinite Line annotation.
line()Creates and returns a Line annotation.
marker()Creates and returns a Marker annotation.
ray()Creates and returns a Ray annotation.
rectangle()Creates and returns a Rectangle annotation.
removeAllAnnotations()Removes all annotations from a plot.
removeAnnotation()Removes an annotation from a plot by its instance.
removeAnnotationAt()Removes an annotation from a plot by its index.
startDrawing()Starts annotation drawing.
trendChannel()Creates and returns a Trend Channel annotation.
triangle()Creates and returns a Triangle annotation.
verticalLine()Creates and returns a Vertical Line annotation.
Events
listen()Adds an event listener.
listenOnce()Adds a single time event listener.
removeAllListeners()Removes all listeners.
unlisten()Removes the listener.
unlistenByKey()Removes the listener by the key.
Export
print()Prints all elements.
Interactivity
select()Selects annotation.
unselect()Unselects annotations.
Size and Position
zIndex()Z-index of the element.
XML/JSON
fromJson()Creates annotations list by JSON config.
fromXml()Creates annotations list by XML config.
toJson()Return plot annotations configuration as JSON object or string.
toXml()Return plot annotations configuration as XML string or XMLNode.

Methods Description

add

Adds annotation on the plot.

Params:

Name Type Description
annotationTypeOrConfig anychart.enums.AnnotationTypes | anychart.core.annotations.AnnotationJSONFormat Annotation settings.

Returns:

anychart.core.annotations.Base - Annotation instance

Try it:

andrewsPitchfork

Creates and returns an Andrews Pitchfork annotation.

Params:

Name Type Description
config Object Andrews pitchfork settings

Returns:

anychart.core.annotations.AndrewsPitchfork - Andrews pitchfork annotation instance.

Try it:

cancelDrawing

Cancels current annotation drawing.

Try it:

ellipse

Creates and returns an Ellipse annotation.

Params:

Name Type Description
config Object Ellipse settings

Returns:

anychart.core.annotations.Ellipse - Ellipse annotation instance.

Try it:

enabled

Getter for the enabled state.

Returns:

boolean - Enabled state.
Setter for the enabled state.

Params:

Name Type Description
value boolean Value to set.

Returns:

anychart.core.annotations.PlotController - Self instance for method chaining.

Try it:

fibonacciArc

Creates and returns a Fibonacci Arc annotation.

Params:

Name Type Description
config Object Fibonacci arc settings

Returns:

anychart.core.annotations.FibonacciArc - Fibonacci arc annotation instance.

Try it:

fibonacciFan

Creates and returns a Fibonacci Fan annotation.

Params:

Name Type Description
config Object Fibonacci fan settings

Returns:

anychart.core.annotations.FibonacciFan - Fibonacci fan annotation instance.

Try it:

fibonacciRetracement

Creates and returns a Fibonacci Retracement annotation.

Params:

Name Type Description
config Object Fibonacci retracement settings

Returns:

anychart.core.annotations.FibonacciRetracement - Fibonacci retracement annotation instance.

Try it:

fibonacciTimezones

Creates and returns a Fibonacci Timezones annotation.

Params:

Name Type Description
config Object Fibonacci timezones settings

Returns:

anychart.core.annotations.FibonacciTimezones - Fibonacci timezones annotation instance.

Try it:

fromJson

Creates annotations list by JSON config.

Params:

Name Type Description
config Object | string JSON configuration as object or string.

Returns:

anychart.core.annotations.PlotController - Self instance for method chaining.

fromXml

Creates annotations list by XML config.

Params:

Name Type Description
config string | Node Configuration as XML string or XMLNode.

Returns:

anychart.core.annotations.PlotController - Self instance for method chaining.

getAnnotationAt

Returns annotation by index.

Params:

Name Type Description
index number Index of the annotation.

Returns:

anychart.core.annotations.Base - Annotation instance.

Try it:

getAnnotationsCount

Returns annotations count.

Returns:

number - Number of annotations.

Try it:

getSelectedAnnotation

Returns currently selected annotation.

Returns:

anychart.core.annotations.Base - Annotation instance.

Try it:

horizontalLine

Creates and returns a Horizontal Line annotation.

Params:

Name Type Description
config Object Horizontal line settings

Returns:

anychart.core.annotations.HorizontalLine - Horizontal line annotation instance.

Try it:

infiniteLine

Creates and returns an Infinite Line annotation.

Params:

Name Type Description
config Object Infinite line settings.

Returns:

anychart.core.annotations.InfiniteLine - Infinite line annotation instance.

Try it:

line

Creates and returns a Line annotation.

Params:

Name Type Description
config Object Line settings.

Returns:

anychart.core.annotations.Line - Line annotation instance.

Try it:

listen

Adds an event listener to an implementing object.

Params:

Name Type Description
type string The event type id.
listener function Callback method. Function that looks like function(event){ // event.actualTarget - actual event target // event.currentTarget - current event target // event.iterator - event iterator // event.originalEvent - original event // event.point - event point // event.pointIndex - event point index }.
useCapture boolean Whether to fire in capture phase (defaults to false).
listenerScope Object Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

Try it:

listenOnce

Adds an event listener to an implementing object.

Params:

Name Type Description
type string The event type id.
listener function Callback method.
useCapture boolean Whether to fire in capture phase (defaults to false).
listenerScope Object Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

Try it:

marker

Creates and returns a Marker annotation.

Params:

Name Type Description
config Object Marker settings

Returns:

anychart.core.annotations.Marker - Marker annotation instance.

Try it:

print

Prints all elements on related stage.

Params:

Name Type Default Description
paperSize anychart.graphics.vector.PaperSize
Paper size.
landscape boolean
false
Flag of landscape.

Try it:

ray

Creates and returns a Ray annotation.

Params:

Name Type Description
config Object Ray settings.

Returns:

anychart.core.annotations.Ray - Ray annotation instance.

Try it:

rectangle

Creates and returns a Rectangle annotation.

Params:

Name Type Description
config Object Rectangle settings

Returns:

anychart.core.annotations.Rectangle - Rectangle annotation instance.

Try it:

removeAllAnnotations

Removes all annotations from a plot.

Returns:

anychart.core.annotations.PlotController - Self for method chaining.

Try it:

removeAllListeners

Removes all listeners from an object. You can also optionally remove listeners of some particular type.

Params:

Name Type Description
type string Type of event to remove, default is to remove all types.

Returns:

number - Number of listeners removed.

Try it:

removeAnnotation

Removes an annotation from a plot by its instance.

Params:

Name Type Description
annotation anychart.core.annotations.Base Annotation instance

Returns:

anychart.core.annotations.PlotController - Self instance for method chaining.

Try it:

removeAnnotationAt

Removes an annotation from a plot by its index.

Params:

Name Type Description
index number Annotations index.

Returns:

anychart.core.annotations.PlotController - Self instance for method chaining.

Try it:

select

Selects annotation.

Params:

Name Type Description
annotation anychart.core.annotations.Base Annotation instance to set.

Returns:

anychart.core.annotations.PlotController - Self instance for method chaining.

Try it:

startDrawing

Starts annotation drawing.
Note: Works only after anychart.charts.Cartesian#draw and anychart.charts.Stock#draw is called.

Params:

Name Type Description
annotationTypeOrConfig anychart.enums.AnnotationTypes | anychart.core.annotations.AnnotationJSONFormat Annotation settings.

Returns:

anychart.core.annotations.Base - Annotation instance.

Try it:

toJson

Return plot annotations configuration as JSON object or string.

Params:

Name Type Default Description
stringify boolean
false
Returns JSON as string.
includeTheme boolean
false
If the current theme properties should be included into the result.

Returns:

Object string - Plot annotations configuration

toXml

Return plot annotations configuration as XML string or XMLNode.

Params:

Name Type Default Description
asXmlNode boolean
false
Return XML as XMLNode.
includeTheme boolean
false
If the current theme properties should be included into the result.

Returns:

string Node - Plot annotations configuration.

trendChannel

Creates and returns a Trend Channel annotation.

Params:

Name Type Description
config Object Trend channel settings

Returns:

anychart.core.annotations.TrendChannel - Trend channel annotation instance.

Try it:

triangle

Creates and returns a Triangle annotation.

Params:

Name Type Description
config Object Triangle settings

Returns:

anychart.core.annotations.Triangle - Triangle annotation instance.

Try it:

unlisten

Removes a listener added using listen() or listenOnce() methods.

Params:

Name Type Description
type string The event type id.
listener function Callback method.
useCapture boolean Whether to fire in capture phase (defaults to false).
listenerScope Object Object in whose scope to call the listener.

Returns:

boolean - Whether any listener was removed.

Try it:

unlistenByKey

Removes an event listener which was added with listen() by the key returned by listen() or listenOnce().

Params:

Name Type Description
key Object The key returned by listen() or listenOnce().

Returns:

boolean - Whether any listener was removed.

Try it:

unselect

Unselects annotations.

Returns:

anychart.core.annotations.PlotController - Self instance for method chaining.

Try it:

verticalLine

Creates and returns a Vertical Line annotation.

Params:

Name Type Description
config Object Vertical line settings

Returns:

anychart.core.annotations.VerticalLine - Vertical line annotation instance.

Try it:

zIndex

Getter for the current Z-index of the element.

Returns:

number - The current zIndex.

Try it:

Setter for the Z-index of the element.

Params:

Name Type Default Description
value number
0
Value to set.

Returns:

anychart.core.VisualBase - Self instance for method chaining.

Try it: