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.
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()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.

listen

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
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(e:Object)
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 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.

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

unlisten

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

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object):boolean|undefined
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 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.