AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.standalones.MarkersFactory Improve this Doc

Extends: anychart.core.ui.MarkersFactory

The MarkersFactory class contains methods for configuring standalones markers factory.

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()Markers Z-index.
Miscellaneous
add()Adds new marker and adds it to a set taking positionProvider into account.
clear()Clears an array of markers.
container()Container for the elements.
draw()Markers drawing.
measure()Calculates bounds for the marker.
parentBounds()Getter for the parent bounds.

Methods Description

add

Adds new marker and adds it to a set taking positionProvider into account.

Params:

NameTypeDescription
positionProvider*Object with position settings, it must contain x and y without offsets. Can contain any additional info, if needed.
indexnumberMarker index.

Returns:

anychart.standalones.MarkersFactory - Self instance for method chaining.

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.standalones.MarkersFactory - Self instance for method chaining.

clear

Clears an array of markers.

Params:

NameTypeDescription
indexnumberIf set, removes only the marker that is in passed index.

Returns:

anychart.standalones.MarkersFactory - Self instance for method chaining.

container

Getter for the container.

Returns:

anychart.graphics.vector.Layer | anychart.graphics.vector.Stage - An instance of the class for method chaining.
Setter for the container.

Params:

NameTypeDescription
elementanychart.graphics.vector.Layer | anychart.graphics.vector.Stage | string | ElementThe value to set.

Returns:

anychart.standalones.MarkersFactory - Self instance for method chaining.

draw

Markers drawing.

Returns:

anychart.standalones.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.standalones.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.standalones.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.standalones.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.standalones.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.standalones.MarkersFactory - Self instance for method chaining.

Params:

NameTypeDescription
imageSettingsanychart.graphics.vector.FillObject with settings.

Returns:

anychart.standalones.MarkersFactory - Self instance for method chaining.

measure

Calculates bounds for the marker.

Params:

NameTypeDescription
positionProvider*Object with information about marker with current index, it must contain x and y fields (with no offsets taken in account). You can add any custom information of needed.

Returns:

anychart.math.Rect - Markers bounds.

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.standalones.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.standalones.MarkersFactory - Self instance for method chaining.

parentBounds

Getter for the parent bounds.
Bounds that would be used in case of percent size calculations. Expects pixel values only.

Returns:

anychart.math.Rect - The parent bounds of the element.
Setter for the parent bounds using single value.
Bounds that would be used in case of percent size calculations. Expects pixel values only.

Params:

NameTypeDescription
boundsanychart.math.Rect | Object | number | nullBounds to set.

Returns:

anychart.standalones.MarkersFactory - Self instance for method chaining.
Setter for the parent bounds using several values.
Bounds that would be used in case of percent size calculations. Expects pixel values only.

Params:

NameTypeDescription
leftnumberLeft space.
topnumberTop space.
widthnumberElement width.
heightnumberElement height.

Returns:

anychart.standalones.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.standalones.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.standalones.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.standalones.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.standalones.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.standalones.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.standalones.MarkersFactory - Self instance for method chaining.
Setter for stroke using an object.

Params:

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

Returns:

anychart.standalones.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.standalones.MarkersFactory - Self instance for method chaining.

zIndex

Getter for the Z-index of the markers.

Returns:

number - Chart Z-index.
See listing
var zIndex = markers.zIndex();
Setter for the Z-index of the markers.

Params:

NameTypeDefaultDescription
zIndexnumber
31.000012
Z-index to set.

Returns:

anychart.standalones.MarkersFactory - Self instance for method chaining.