AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated 7.12.0 version of this document. Switch to the 8.4.0 version to see the up to date information.

class anychart.core.annotations.Line Improve this Doc

Extends: anychart.core.annotations.Base

Line annotation.

Methods Overview

Specific settings
getPlot()Returns the plot on which the annotation is drawn.
getType()Returns annotation type.
hoverMarkers()Hover markers settings.
markers()Markers settings.
selectMarkers()Select markers settings.
Axes and Scales
xScale()X-scale settings
yScale()Y-scale settings
Charts
getChart()Returns the chart on which the annotation is drawn.
Coloring
color()Color settings.
hoverStroke()Hover stroke settings.
selectStroke()Select stroke settings.
stroke()Stroke settings.
Interactivity
allowEdit()Interactivity settings.
Size and Position
hoverGap()Hover gap settings.
secondValueAnchor()Second value anchor settings
secondXAnchor()Second X anchor settings
valueAnchor()Value anchor settings
xAnchor()X anchor settings

Methods Description

allowEdit

Getter for an interactivity in the annotation.

Returns:

boolean - Interactivity settings.
See listing.
var currentAllowEdit = annotation.allowEdit();
Setter for an interactivity in the annotation.

Params:

NameTypeDescription
value*Whether to disable the interactivity in the annotation. If set to false, the interactivity is disabled in the annotation.

Returns:

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

color

Getter for the annotation color.

Returns:

anychart.graphics.vector.Fill - The annotation color.
See listing.
var currentColor = annotation.color();
Setter for the color settings using an array or a string.

Params:

NameTypeDescription
valueanychart.graphics.vector.FillColor as an object or a string.

Returns:

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

getChart

Returns the chart on which the annotation is drawn.

getPlot

Returns the plot on which the annotation is drawn.

Returns:

anychart.core.stock.Plot - Stock plot.

getType

Returns annotation type.

Returns:

anychart.enums.AnnotationTypes | string - Annotation type

hoverGap

Getter for the hover gap.

Returns:

number - The hover gap value.
See listing.
var currentHoverGap = annotation.hoverGap();
Setter for the hover gap.
The contour size around annotation.

Params:

NameTypeDescription
value*Value to set.

Returns:

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

hoverMarkers

Getter for data hover markers.

Returns:

anychart.core.ui.MarkersFactory - Markers instance.
Setter for data hover markers.

Params:

NameTypeDefaultDescription
valueObject | boolean | null | string
false
Data markers settings.

Returns:

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

hoverStroke

Getter for hover stroke settings.

Returns:

anychart.graphics.vector.Stroke - Hover stroke settings.
See listing.
var currentAnnotationHoverStroke = annotation.hoverStroke();
Setter for hover stroke by function.

Params:

NameTypeDefaultDescription
strokeFunctionfunction
function() {
 return anychart.color.darken(this.sourceColor);
}
Function that looks like function(){ // this.index - series index. // this.sourceColor - color returned by fill() getter. // this.iterator - series point iterator. return strokeValue; // type anychart.graphics.vector.Stroke or anychart.graphics.vector.ColoredFill }.

Returns:

anychart.core.annotations.Line - Self instance for method chaining.
Setter for hover stroke settings. Learn more about stroke settings.

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
Stroke settings.
thicknessnumber
1
Line thickness.
dashpatternstring
Controls the pattern of dashes and gaps used to stroke paths.
lineJoinanychart.graphics.vector.StrokeLineJoin
Line join style.
lineCapanychart.graphics.vector.StrokeLineCap
Line cap style.

Returns:

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

markers

Getter for data markers.

Returns:

anychart.core.ui.MarkersFactory - Markers instance.
Setter for data markers.

Params:

NameTypeDefaultDescription
valueObject | boolean | null | string
false
Data markers settings.

Returns:

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

secondValueAnchor

Getter for the second value anchor.

Returns:

* - The second value anchor.
See listing.
var controller = chart.annotations();
var annotation = controller.line();
var currentSecondValueAnchor = annotation.secondValueAnchor();
Setter for the second value anchor.

Params:

NameTypeDescription
Second*value anchor to set.

Returns:

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

secondXAnchor

Getter for the second X anchor.

Returns:

* - The second X anchor.
See listing.
var controller = chart.annotations();
var annotation = controller.line();
var currentSecondXAnchor = annotation.secondXAnchor();
Setter for the second X anchor.

Params:

NameTypeDescription
Second*X anchor to set.

Returns:

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

selectMarkers

Getter for data select markers.

Returns:

anychart.core.ui.MarkersFactory - Markers instance.
Setter for data select markers.

Params:

NameTypeDefaultDescription
valueObject | boolean | null | string
false
Data markers settings.

Returns:

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

selectStroke

Getter for select stroke settings.

Returns:

anychart.graphics.vector.Stroke - Select stroke settings.
See listing.
var currentAnnotationSelectStroke = annotation.selectStroke();
Setter for select stroke by function.

Params:

NameTypeDefaultDescription
strokeFunctionfunction
function() {
 return anychart.color.darken(this.sourceColor);
}
Function that looks like function(){ // this.index - series index. // this.sourceColor - color returned by fill() getter. // this.iterator - series point iterator. return strokeValue; // type anychart.graphics.vector.Stroke or anychart.graphics.vector.ColoredFill }.

Returns:

anychart.core.annotations.Line - Self instance for method chaining.
Setter for select stroke settings. Learn more about stroke settings.

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
Stroke settings.
thicknessnumber
1
Line thickness.
dashpatternstring
Controls the pattern of dashes and gaps used to stroke paths.
lineJoinanychart.graphics.vector.StrokeLineJoin
Line join style.
lineCapanychart.graphics.vector.StrokeLineCap
Line cap style.

Returns:

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

stroke

Getter for stroke settings.

Returns:

anychart.graphics.vector.Stroke - Stroke settings.
See listing.
var currentAnnotationStroke = annotation.stroke();
Setter for annotations stroke by function.

Params:

NameTypeDefaultDescription
strokeFunctionfunction
function() {
 return anychart.color.darken(this.sourceColor);
}
Function that looks like function(){ // this.index - series index. // this.sourceColor - color returned by fill() getter. // this.iterator - series point iterator. return strokeValue; // type anychart.graphics.vector.Stroke or anychart.graphics.vector.ColoredFill }.

Returns:

anychart.core.annotations.Line - Self instance for method chaining.
Setter for annotations stroke settings. Learn more about stroke settings.

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
Stroke settings.
thicknessnumber
1
Line thickness.
dashpatternstring
Controls the pattern of dashes and gaps used to stroke paths.
lineJoinanychart.graphics.vector.StrokeLineJoin
Line join style.
lineCapanychart.graphics.vector.StrokeLineCap
Line cap style.

Returns:

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

valueAnchor

Getter for the value anchor.

Returns:

* - The value anchor.
See listing.
var controller = chart.annotations();
var annotation = controller.line();
var currentValueAnchor = annotation.valueAnchor();
Setter for the value anchor.

Params:

NameTypeDescription
value*Value anchor to set.

Returns:

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

xAnchor

Getter for the X anchor.

Returns:

* - The X anchor.
See listing.
var controller = chart.annotations();
var annotation = controller.line();
var currentXAnchor = annotation.xAnchor();
Setter for the X anchor.

Params:

NameTypeDescription
value*X anchor to set.

Returns:

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

xScale

Getter for the X-scale.
Setter for the X-scale.

Params:

NameTypeDescription
valueanychart.scales.Base | anychart.scales.StockScatterDateTimeValue to set

Returns:

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

yScale

Getter for the Y-scale.

Returns:

anychart.scales.Base - Default scale value.
Setter for the Y-scale.

Params:

NameTypeDescription
valueanychart.scales.BaseY-scale to set.

Returns:

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