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

class anychart.elements.Axis Improve this Doc

Methods Overview

Miscellaneous
drawFirstLabel()Getter for the first label drawing flag.
drawLastLabel()Getter for the last label drawing flag.
getRemainingBounds()Returns remaining parent bounds to use elsewhere.
isHorizontal()Whether an axis is horizontal.
labels()Getter for axis labels.
length()Getter for axis length.
minorLabels()Getter for axis minor labels.
minorTicks()Getter for minor axis ticks.
name()Getter for axis name.
offsetX()Getter for axis X offset.
offsetY()Getter for axis Y offset.
orientation()Getter for axis orientation.
overlapMode()Getter for overlap mode for labels.
parentBounds()Getter for parentBounds.
scale()Getter for axis scale.
staggerLines()Getter for stagger lines.
staggerMaxLines()Getter for maximum stagger lines.
staggerMode()Getter for stagger mode state.
stroke()Getter for axis line stroke.
ticks()Getter for axis ticks.
title()Getter for the title axis.

Methods Description

drawFirstLabel

Getter for the first label drawing flag.

Returns:

boolean - Drawing flag.
Setter for the first label drawing flag.

Params:

Name Type Default Description
value boolean
true
Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

drawLastLabel

Getter for the last label drawing flag.

Returns:

boolean - Drawing flag.
Setter for the last label drawing flag.

Params:

Name Type Default Description
value boolean
true
Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

getRemainingBounds

Returns remaining parent bounds to use elsewhere.

Returns:

anychart.math.Rect - Parent bounds without the space used by the title.

isHorizontal

Whether an axis is horizontal.

Returns:

boolean - If the axis is horizontal.

labels

Getter for axis labels.

Returns:

anychart.elements.LabelsFactory - Axis labels of itself for method chaining.
Setter for axis labels.

Params:

Name Type Description
value anychart.elements.LabelsFactory Value to set.

Returns:

anychart.elements.Axis - An instance of the anychart.elements.Axis class for method chaining.

length

Getter for axis length.

Returns:

number - Axis length.
Setter for axis length.
Note: width and height swap in case of horizontal axis.

Params:

Name Type Description
value number Axis length.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

minorLabels

Getter for axis minor labels.

Returns:

anychart.elements.LabelsFactory - Axis labels.
Setter for axis minor labels.

Params:

Name Type Description
value anychart.elements.LabelsFactory Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis class for method chaining.

minorTicks

Getter for minor axis ticks.

Returns:

anychart.elements.Ticks - Axis ticks.
Setter for minor axis ticks.

Params:

Name Type Description
value anychart.elements.Ticks Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

name

Getter for axis name.

Returns:

string - Axis name.
Setter for axis name.

Params:

Name Type Description
value string Name.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

offsetX

Getter for axis X offset.

Returns:

number - Offset by X.
Setter for axis X offset.

Params:

Name Type Description
value number Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

offsetY

Getter for axis Y offset.

Returns:

number - Offset by Y.
Setter for axis Y offset.

Params:

Name Type Description
value number Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis for method chaining.

orientation

Getter for axis orientation.

Returns:

string anychart.enums.Orientation - Axis orientation.
Setter for axis orientation.

Params:

Name Type Description
value string | anychart.enums.Orientation Value to set.

Returns:

anychart.elements.Axis - An instance of the anychart.elements.Axis class for method chaining.

overlapMode

Getter for overlap mode for labels.

Returns:

anychart.enums.LabelsOverlapMode string - OverlapMode flag.
Setter for overlap mode for labels.

Params:

Name Type Default Description
value anychart.enums.LabelsOverlapMode | string
anychart.enums.LabelsOverlapMode.NO_OVERLAP
Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

parentBounds

Getter for parentBounds.

Returns:

anychart.graphics.math.Rect - Current parent bounds.
Setter for parentBounds.

Params:

Name Type Description
value anychart.graphics.math.Rect Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis class for method chaining.

scale

Getter for axis scale.

Returns:

anychart.scales.Base - Axis scale.
Setter for axis scale.

Params:

Name Type Description
value anychart.scales.Base Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

staggerLines

Getter for stagger lines.

Returns:

number - Current stagger line settings.
Setter for stagger lines.
Note: pass null to enable autocalculation.

Params:

Name Type Default Description
value number | null
null
Count of stager lines.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

Try it:

staggerMaxLines

Getter for maximum stagger lines.

Returns:

number - Current stagger line settings.
Setter for maximum stagger lines in autocalculation mode (if anychart.elements.Axis#staggerLines passed null).

Params:

Name Type Default Description
value number | null
2
Limits the number of lines to be used when drawing labels. If we need less – we use less, but never – more.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

Try it:

staggerMode

Getter for stagger mode state.

Returns:

boolean - Current stagger mode state.
Setter for stagger mode state.

Params:

Name Type Default Description
value boolean
true
On/off stagger mode.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

Try it:

stroke

Getter for axis line stroke.

Returns:

string anychart.graphics.vector.Stroke - Axis line stroke settings.
Setter for axis line stroke.

Params:

Name Type Description
value string | anychart.graphics.vector.Stroke Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

ticks

Getter for axis ticks.

Returns:

anychart.elements.Ticks - Axis ticks.
Setter for axis ticks.

Params:

Name Type Description
value anychart.elements.Ticks Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis instance for method chaining.

title

Getter for the title axis.

Returns:

string anychart.elements.Title - Axis title.
Setter for the title axis.

Params:

Name Type Description
value string | anychart.elements.Title Value to set.

Returns:

anychart.elements.Axis - anychart.elements.Axis class for method chaining.