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
Params:
Name | Type | Description |
---|---|---|
annotationTypeOrConfig | anychart.enums.AnnotationTypes | anychart.core.annotations.AnnotationJSONFormat | Annotation settings. |
Returns:
anychart.core.annotations.Base - Annotation instanceTry it:
andrewsPitchfork
Params:
Name | Type | Description |
---|---|---|
config | Object | Andrews pitchfork settings |
Returns:
anychart.core.annotations.AndrewsPitchfork - Andrews pitchfork annotation instance.Try it:
cancelDrawing
Try it:
ellipse
Params:
Name | Type | Description |
---|---|---|
config | Object | Ellipse settings |
Returns:
anychart.core.annotations.Ellipse - Ellipse annotation instance.Try it:
enabled
Returns:
boolean - Enabled state.Params:
Name | Type | Description |
---|---|---|
value | boolean | Value to set. |
Returns:
anychart.core.annotations.PlotController - Self instance for method chaining.Try it:
fibonacciArc
Params:
Name | Type | Description |
---|---|---|
config | Object | Fibonacci arc settings |
Returns:
anychart.core.annotations.FibonacciArc - Fibonacci arc annotation instance.Try it:
fibonacciFan
Params:
Name | Type | Description |
---|---|---|
config | Object | Fibonacci fan settings |
Returns:
anychart.core.annotations.FibonacciFan - Fibonacci fan annotation instance.Try it:
fibonacciRetracement
Params:
Name | Type | Description |
---|---|---|
config | Object | Fibonacci retracement settings |
Returns:
anychart.core.annotations.FibonacciRetracement - Fibonacci retracement annotation instance.Try it:
fibonacciTimezones
Params:
Name | Type | Description |
---|---|---|
config | Object | Fibonacci timezones settings |
Returns:
anychart.core.annotations.FibonacciTimezones - Fibonacci timezones annotation instance.Try it:
fromJson
Params:
Name | Type | Description |
---|---|---|
config | Object | string | JSON configuration as object or string. |
Returns:
anychart.core.annotations.PlotController - Self instance for method chaining.fromXml
Params:
Name | Type | Description |
---|---|---|
config | string | Node | Configuration as XML string or XMLNode. |
Returns:
anychart.core.annotations.PlotController - Self instance for method chaining.getAnnotationAt
Params:
Name | Type | Description |
---|---|---|
index | number | Index of the annotation. |
Returns:
anychart.core.annotations.Base - Annotation instance.Try it:
getAnnotationsCount
getSelectedAnnotation
Returns:
anychart.core.annotations.Base - Annotation instance.Try it:
horizontalLine
Params:
Name | Type | Description |
---|---|---|
config | Object | Horizontal line settings |
Returns:
anychart.core.annotations.HorizontalLine - Horizontal line annotation instance.Try it:
infiniteLine
Params:
Name | Type | Description |
---|---|---|
config | Object | Infinite line settings. |
Returns:
anychart.core.annotations.InfiniteLine - Infinite line annotation instance.Try it:
line
Params:
Name | Type | Description |
---|---|---|
config | Object | Line settings. |
Returns:
anychart.core.annotations.Line - Line annotation instance.Try it:
listen
Note Notice that if the existing listener is one-off (added using listenOnce), it will cease to be such after calling the listen() method.
Params:
Name | Type | Default | 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 | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
Object - Unique key for the listener.Try it:
listenOnce
If the event handler being added already exists, listenOnce will do nothing.
Note In particular, if the handler is already registered using listen(), listenOnce() will not make it one-off. Similarly, if a one-off listener already exists, listenOnce will not change it (it wil remain one-off).
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
Object - Unique key for the listener.Try it:
marker
Params:
Name | Type | Description |
---|---|---|
config | Object | Marker settings |
Returns:
anychart.core.annotations.Marker - Marker annotation instance.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
paperSizeOrOptions | anychart.graphics.vector.PaperSize | Object | Paper size or object with options. | |
landscape | boolean | false | Flag of landscape. |
Try it:
ray
Params:
Name | Type | Description |
---|---|---|
config | Object | Ray settings. |
Returns:
anychart.core.annotations.Ray - Ray annotation instance.Try it:
rectangle
Params:
Name | Type | Description |
---|---|---|
config | Object | Rectangle settings |
Returns:
anychart.core.annotations.Rectangle - Rectangle annotation instance.Try it:
removeAllAnnotations
Returns:
anychart.core.annotations.PlotController - Self for method chaining.Try it:
removeAllListeners
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
Params:
Name | Type | Description |
---|---|---|
annotation | anychart.core.annotations.Base | Annotation instance |
Returns:
anychart.core.annotations.PlotController - Self instance for method chaining.Try it:
removeAnnotationAt
Params:
Name | Type | Description |
---|---|---|
index | number | Annotations index. |
Returns:
anychart.core.annotations.PlotController - Self instance for method chaining.Try it:
select
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
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
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 configurationtoXml
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
Params:
Name | Type | Description |
---|---|---|
config | Object | Trend channel settings |
Returns:
anychart.core.annotations.TrendChannel - Trend channel annotation instance.Try it:
triangle
Params:
Name | Type | Description |
---|---|---|
config | Object | Triangle settings |
Returns:
anychart.core.annotations.Triangle - Triangle annotation instance.Try it:
unlisten
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
boolean - Whether any listener was removed.Try it:
unlistenByKey
Params:
Name | Type | Description |
---|---|---|
key | Object | The key returned by listen() or listenOnce(). |
Returns:
boolean - Whether any listener was removed.Try it:
unselect
Returns:
anychart.core.annotations.PlotController - Self instance for method chaining.Try it:
verticalLine
Params:
Name | Type | Description |
---|---|---|
config | Object | Vertical line settings |
Returns:
anychart.core.annotations.VerticalLine - Vertical line annotation instance.Try it:
zIndex
Returns:
number - The current zIndex.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | 0 | Value to set. |
Returns:
anychart.core.annotations.PlotController - Self instance for method chaining.Try it: