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

NameTypeDefaultDescription
valueboolean
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:

NameTypeDefaultDescription
valueboolean
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:

NameTypeDescription
valueanychart.elements.LabelsFactoryValue 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:

NameTypeDescription
valuenumberAxis 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:

NameTypeDescription
valueanychart.elements.LabelsFactoryValue 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:

NameTypeDescription
valueanychart.elements.TicksValue 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:

NameTypeDescription
valuestringName.

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:

NameTypeDescription
valuenumberValue 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:

NameTypeDescription
valuenumberValue 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:

NameTypeDescription
valuestring | anychart.enums.OrientationValue 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:

NameTypeDefaultDescription
valueanychart.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:

NameTypeDescription
valueanychart.graphics.math.RectValue 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:

NameTypeDescription
valueanychart.scales.BaseValue 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:

NameTypeDefaultDescription
valuenumber | null
null
Count of stager lines.

Returns:

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

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:

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

staggerMode

Getter for stagger mode state.

Returns:

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

Params:

NameTypeDefaultDescription
valueboolean
true
On/off stagger mode.

Returns:

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

stroke

Getter for axis line stroke.

Returns:

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

Params:

NameTypeDescription
valuestring | anychart.graphics.vector.StrokeValue 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:

NameTypeDescription
valueanychart.elements.TicksValue 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:

NameTypeDescription
valuestring | anychart.elements.TitleValue to set.

Returns:

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