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

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.
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
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()Size setting
zIndex()Z-index of the element.

Methods Description

anchor

Getter for the current anchor settings of all markers.

Returns:

anychart.enums.Anchor - Current marker anchor settings.
Setter for the anchor settings of all markers.

Params:

NameTypeDefaultDescription
valueanychart.enums.Anchor | string
"center"
Value to set.

Returns:

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

enabled

Getter for the current element state.

Returns:

boolean - The current element state.
Setter for the element enabled state.

Params:

NameTypeDefaultDescription
valuenull | boolean
null
Value to set.

Returns:

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

fill

Getter for the current fill settings of all markers.

Returns:

anychart.graphics.vector.Fill | string - Markers fill settings.
Setter for fill settings of all markers. Learn more about coloring.

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Fill | string
'black'
Value to set.

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.

listen

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction
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 }.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

listenOnce

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

offsetX

Getter for the current offsetX settings of all markers.

Returns:

number | string - Marker offsetX settings.
Setter for the offsetX settings of all markers.

Params:

NameTypeDefaultDescription
valuenumber | string
0
Value to set.

Returns:

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

offsetY

Getter for the current offsetY settings of all markers.

Returns:

number | string - Markers offsetY settings.
Setter for the offsetY settings of all markers.

Params:

NameTypeDefaultDescription
valuenumber | string
0
Value to set.

Returns:

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

position

Getter for the current position settings of all markers.

Returns:

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

Params:

NameTypeDefaultDescription
valuestring
"center"
Value to set.

Returns:

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

positionFormatter

Getter for the current position formatter function of all markers.

Returns:

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

Params:

NameTypeDefaultDescription
valuefunction
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.

print

Prints all elements on related stage.

Params:

NameTypeDefaultDescription
paperSizeOrOptionsanychart.graphics.vector.PaperSize | Object
Paper size or object with options.
landscapeboolean
false
Flag of landscape.

removeAllListeners

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

Params:

NameTypeDescription
typestringType of event to remove, default is to remove all types.

Returns:

number - Number of listeners removed.

rotation

Getter for the current rotation angle around an anchor.

Returns:

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

Params:

NameTypeDefaultDescription
valuenumber
0
Rotation angle in degrees.

Returns:

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

size

Getter for the current size settings of all markers.

Returns:

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

Params:

NameTypeDefaultDescription
valuenumber
10
Value to set.

Returns:

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

stroke

Getter for the current stroke settings of all markers.

Returns:

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

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Stroke | string
'none'
Value to set.

Returns:

anychart.core.ui.MarkersFactory - Self instance for method chaining.
Setter for the 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.
lineJoinanychart.graphics.vector.StrokeLineJoin
Line join style.
lineCapanychart.graphics.vector.StrokeLineCap
Style of line cap.

Returns:

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

type

Getter for the current type settings of all markers.

Returns:

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

Params:

NameTypeDefaultDescription
valuestring | anychart.enums.MarkerType | function
anychart.enums.MarkerType#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.

unlisten

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

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

boolean - Whether any listener was removed.

unlistenByKey

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

Params:

NameTypeDescription
keyObjectThe key returned by listen() or listenOnce().

Returns:

boolean - Whether any listener was removed.

zIndex

Getter for the current Z-index of the element.

Returns:

number - The current zIndex.
Setter for the Z-index of the element.

Params:

NameTypeDefaultDescription
valuenumber
0
Value to set.

Returns:

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