AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.core.axes.Ticks Improve this Doc

Extends: anychart.core.VisualBase

Axis ticks class.
You can change position, length and line features.

Methods Overview

Coloring
stroke()Stroke settings.
Interactivity
enabled()Element state (enabled or disabled).
Size and Position
length()Ticks length.
position()Ticks position.
zIndex()Z-index of the element.

Methods Description

enabled

Getter for the ticks state (enabled or disabled).

Returns:

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

Params:

NameTypeDescription
enabledbooleanEnabled state to set.

Returns:

anychart.core.axes.Ticks - Self instance for method chaining.
Example.
if (!element.enabled())
   element.enabled(true);

length

Getter for ticks length.

Returns:

number - Length of ticks.
See listing
var axisTicks = yAxis.ticks();
var ticksLength = axisTicks.length();
Setter for ticks length.

Params:

NameTypeDefaultDescription
lengthnumber
6
Value to set.

Returns:

anychart.core.axes.Ticks - Self instance for method chaining.

position

Getter for ticks position.

Returns:

anychart.enums.SidePosition | string - Ticks position.
See listing
var axisTicks = yAxis.ticks();
var axisPosition = axisTicks.position();
Setter for ticks position.
You can set ticks inside of a chart area or outside its position.

Params:

NameTypeDefaultDescription
positionanychart.enums.SidePosition | string
'outside'
Value to set.

Returns:

anychart.core.axes.Ticks - Self instance for method chaining.

stroke

Getter for stroke settings.

Returns:

anychart.graphics.vector.Stroke - Returns stroke settings.
See listing
var axisTicks = yAxis.ticks();
var ticksPosition = axisTicks.position();
Setter for stroke settings via single parameter.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Stroke
'#cecece'
Fill style as '[thickness ]color[ opacity]'.

Returns:

anychart.core.axes.Ticks - Self instance for method chaining.
Setter for stroke settings via several parameter.
The following options are acceptable: Note: String parts order is significant and '3px red' is not the same as 'red 3px'.

Params:

NameTypeDefaultDescription
colorstring
Stroke color.
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
Line cap style.

Returns:

anychart.core.axes.Ticks - Self instance for method chaining.
Setter for stroke settings using an object.

Params:

NameTypeDescription
settingsObjectObject with stroke settings from anychart.graphics.vector.Stroke

Returns:

anychart.core.axes.Ticks - 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.axes.Ticks - Self instance for method chaining.