AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.core.ui.MarkersFactory Improve this Doc

Extends: anychart.core.VisualBase

Multiple markers class.
Multiple markers are the set of markers with a common settings, such as type (predefined or custom), size, fill and position:

Also you can access any marker from the set and change it.

Methods Overview

Specific settings
type()Type settings.
Coloring
fill()Fill settings.
stroke()Stroke settings.
Interactivity
enabled()Element state (enabled or disabled).
Size and Position
anchor()Anchor settings.
offsetX()Offset by X.
offsetY()Offset by Y.
position()Position settings.
positionFormatter()Position formatter function.
rotation()Rotation settings.
size()Markers size
zIndex()Z-index of the element.

Methods Description

anchor

Getter for anchor settings of all markers.

Returns:

anychart.enums.Anchor | string - Marker anchor settings.
Setter for anchor settings of all markers.

Params:

NameTypeDefaultDescription
anchoranychart.enums.Anchor | string
'center'
Value to set.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

enabled

Getter for the element state.

Returns:

boolean - Element state.
Setter for the element enabled state.

Params:

NameTypeDefaultDescription
enablednull | boolean
null
Enabled state to set.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

fill

Getter for fill settings of all markers.

Returns:

anychart.graphics.vector.Fill | string - Markers fill settings.
Setter for fill settings of all markers using an array, an object and a string. Learn more about coloring.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Fill | Array.<(anychart.graphics.vector.GradientKey|string)>
{color: "#64b5f6", opacity: 1}
Color as an array, an object or a string.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.
Fill color with opacity. Fill as a string or an object.

Params:

NameTypeDescription
colorstringColor as a string.
opacitynumberColor opacity.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.
Linear gradient fill. Learn more about coloring.

Params:

NameTypeDescription
keysArray.<(anychart.graphics.vector.GradientKey|string)>Gradient keys.
anglenumberGradient angle.
modeboolean | anychart.graphics.vector.Rect | ObjectGradient mode.
opacitynumberGradient opacity.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.
Radial gradient fill. Learn more about coloring.

Params:

NameTypeDescription
keysArray.<(anychart.graphics.vector.GradientKey|string)>Color-stop gradient keys.
cxnumberX ratio of center radial gradient.
cynumberY ratio of center radial gradient.
modeanychart.graphics.math.RectIf defined then userSpaceOnUse mode, else objectBoundingBox.
opacitynumberOpacity of the gradient.
fxnumberX ratio of focal point.
fynumberY ratio of focal point.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

Params:

NameTypeDescription
imageSettingsanychart.graphics.vector.FillObject with settings.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

offsetX

Getter for the offset by X of all markers.

Returns:

number | string - Marker offset by X.
Setter for the offset by X of all markers.

Params:

NameTypeDefaultDescription
offsetnumber | string
0
Offset by X to set.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

offsetY

Getter for the offset by Y of all markers.

Returns:

number | string - Markers offset by Y.
Setter for the offset by Y of all markers.

Params:

NameTypeDefaultDescription
offsetnumber | string
0
Offset by Y to set.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

position

Getter for position settings of all markers.

Returns:

string - Markers position settings.
Setter for position settings of all markers.

Params:

NameTypeDefaultDescription
positionstring
'center'
Position to set.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

positionFormatter

Getter for the position formatter function of all markers.

Returns:

function - Marker position formatter function.
Setter for the position formatter function of all markers.

Params:

NameTypeDefaultDescription
formatterfunction(positionProvider:*, index:number):anychart.math.CoordinateObject
function(positionProvider, index) {
 return {x: 80 * index, y: 0};
}
Function to position marker depending on index and context, it should look like this:
function(positionProvider, index) {
   ... //do something
   return {x: smth, y: smth};
}
Parameters:
positionProvider - object with information about current (by index) marker position, this object must contain x and y field (with no offsets taken in account).
index - current marker index.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

rotation

Getter for the rotation angle around an anchor.

Returns:

number - Rotation angle in degrees.
Setter for the rotation angle around an anchor. (anychart.graphics.vector.Element).

Params:

NameTypeDefaultDescription
rotationnumber
0
Rotation angle in degrees.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

size

Getter for the size of all markers.

Returns:

number - Markers size.
Setter for the size of all markers.

Params:

NameTypeDefaultDescription
sizenumber
10
Size to set.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

stroke

Getter for stroke settings of all markers.

Returns:

anychart.graphics.vector.Stroke | string - Markers stroke settings.
Setter for stroke settings of all markers. Learn more about stroke settings.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string
'none'
Color to set.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.
Setter for stroke settings of all markers. Learn more about stroke settings.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | null
Stroke settings.
thicknessnumber
1
Line thickness.
dashpatternstring
Controls the pattern of dashes and gaps used to stroke paths.
lineJoinstring | anychart.graphics.vector.StrokeLineJoin
Line join style.
lineCapstring | anychart.graphics.vector.StrokeLineCap
Style of line cap.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.
Setter for stroke using an object.

Params:

NameTypeDescription
settingsObjectStroke settings from anychart.graphics.vector.Stroke.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

type

Getter for type settings of all markers.

Returns:

anychart.enums.MarkerType | string | function - Markers type settings.
Setter for type settings of all markers.

Params:

NameTypeDefaultDescription
typeanychart.enums.MarkerType | string | function
anychart.enums.MarkerType|string#DIAGONAL_CROSS
Type or custom drawer. Function for a custom marker must look like this:
function(path, x, y, size){
   // path - anychart.graphics.vector.Path
   // x, y - current marker position
   // size - marker size
   ... //do something
   return path;
 

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.

zIndex

Getter for the Z-index of the element.

Returns:

number - Z-index.
Setter for the Z-index of the element.

Params:

NameTypeDefaultDescription
zIndexnumber
0
Value to set.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.