class anychart.standalones.axes.Linear Improve this Doc
Extends: anychart.core.axes.Linear
The Linear class contains methods for configuring standalones Linear axes.
This class allow to create custom Linear axes or add them to charts.
Methods Overview
Specific settings | |
drawFirstLabel() | Drawing of the first label. |
drawLastLabel() | Drawing of the last label. |
labels() | Labels settings. |
minorLabels() | Minor labels settings. |
minorTicks() | Minor ticks settings. |
overlapMode() | Overlap mode for labels. |
scale() | Scale settings. |
staggerLines() | Stagger lines. |
staggerMaxLines() | Maximum stagger lines. |
staggerMode() | Stagger mode state. |
ticks() | Ticks settings. |
title() | Title settings. |
Coloring | |
stroke() | Stroke settings. |
Interactivity | |
enabled() | Element state (enabled or disabled). |
Size and Position | |
getPixelBounds() | Returns pixel bounds of the axis. |
getRemainingBounds() | Returns remaining parent bounds to use elsewhere. |
isHorizontal() | Whether an axis is horizontal. |
orientation() | Axis orientation. |
padding() | Padding settings for the linear axis. |
parentBounds() | Parent bounds for the linear axis. |
width() | Axis width. |
zIndex() | Z-index of the element. |
Miscellaneous | |
container() | Container for the linear axis. |
draw() | Drawing of the linear axis. |
Methods Description
container
Params:
Name | Type | Description |
---|---|---|
element | anychart.graphics.vector.Layer | anychart.graphics.vector.Stage | string | Element | The value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
draw
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
drawFirstLabel
Returns:
boolean - Drawing flag.var yAxis = chart.yAxis(); var flag = yAxis.drawFirstLabel();
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | true | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
drawLastLabel
Returns:
boolean - Drawing flag.var yAxis = chart.yAxis(); var flag = yAxis.drawLastLabel();
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | true | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
enabled
Returns:
boolean - Element state.Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | true | Enabled state to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.if (!element.enabled()) element.enabled(true);
Try it:
getPixelBounds
getRemainingBounds
Returns:
anychart.math.Rect - Parent bounds without the space used by the axis.Try it:
isHorizontal
Returns:
boolean - Returns true if the axis is horizontal.Try it:
labels
- null/boolean - disable or enable axis labels.
- object - sets axis labels settings.
Params:
Name | Type | Default | Description |
---|---|---|---|
settings | Object | boolean | null | true | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.minorLabels
- null/boolean - disable or enable axis minor labels.
- object - sets axis minor labels settings.
Params:
Name | Type | Default | Description |
---|---|---|---|
settings | Object | boolean | null | false | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.minorTicks
- null/boolean - disable or enable axis minor ticks.
- object - sets axis minor ticks settings.
Params:
Name | Type | Default | Description |
---|---|---|---|
settings | Object | boolean | null | false | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.orientation
Returns:
anychart.enums.Orientation | string - Axis orientation.var axis = anychart.standalones.axes.linear(); var orientation = axis.orientation();
Params:
Name | Type | Description |
---|---|---|
orientation | anychart.enums.Orientation | string | Axis orientation to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
overlapMode
Returns:
anychart.enums.LabelsOverlapMode | string - Overlap mode.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
mode | anychart.enums.LabelsOverlapMode | string | 'noOverlap' | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
padding
Returns:
anychart.core.utils.Padding - Axes padding.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
padding | Array.<(number|string)> | Object | {top: 0, right: 0, bottom: 0, left: 0} | Padding to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.// all paddings 15px axis.padding(15); // all paddings 15px axis.padding('15px'); // top and bottom 5px, right and left 15px axis.padding(5, 15);
Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value1 | string | number | 0 | Top or top-bottom space. |
value2 | string | number | 0 | Right or right-left space. |
value3 | string | number | 0 | Bottom space. |
value4 | string | number | 0 | Left space. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.// 1) top and bottom 10px, left and right 15px axis.padding(10, '15px'); // 2) top 10px, left and right 15px, bottom 5px axis.padding(10, '15px', 5); // 3) top 10px, right 15px, bottom 5px, left 12px axis.padding(10, '15px', '5px', 12);
Try it:
parentBounds
Returns:
anychart.math.Rect - Axis parent bounds.Params:
Name | Type | Description |
---|---|---|
bounds | anychart.math.Rect | Object | null | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
left | number | Left space. |
top | number | Top space. |
width | number | Width axis. |
height | number | Height axis. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
scale
Returns:
anychart.scales.Base - Axis scale.var axis = anychart.standalones.axes.linear(); var scale = axis.scale();
Params:
Name | Type | Description |
---|---|---|
settings | anychart.scales.Base | Object | anychart.enums.ScaleTypes | string | Scale settings to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
staggerLines
Returns:
number - Stagger line settings.var yAxis = chart.yAxis(); var lines = yAxis.staggerLines();
Note: pass null to enable autocalculation.
Params:
Name | Type | Default | Description |
---|---|---|---|
count | number | null | Count of stagger lines. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
staggerMaxLines
Returns:
number - Stagger line settings.var yAxis = chart.yAxis(); var maxLines = yAxis.staggerMaxLines();
Params:
Name | Type | Default | Description |
---|---|---|---|
count | 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.standalones.axes.Linear - Self instance for method chaining.Try it:
staggerMode
Returns:
boolean - Stagger mode state.var yAxis = chart.yAxis(); var flag = yAxis.staggerMode();
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | true | On/off stagger mode. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
stroke
Returns:
anychart.graphics.vector.Stroke - Axis stroke settings.var yAxis = chart.yAxis(); var axisStroke = yAxis.stroke();
Params:
Name | Type | Default | Description |
---|---|---|---|
color | anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null | '#CECECE' | Stroke settings. |
thickness | number | 1 | Line thickness. |
dashpattern | string | Controls the pattern of dashes and gaps used to stroke paths. | |
lineJoin | string | anychart.graphics.vector.StrokeLineJoin | Line join style. | |
lineCap | string | anychart.graphics.vector.StrokeLineCap | Line cap style. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
settings | Object | Object with stroke settings from anychart.graphics.vector.Stroke |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
ticks
- null/boolean - disable or enable axis ticks.
- object - sets axis ticks settings.
Params:
Name | Type | Default | Description |
---|---|---|---|
settings | Object | boolean | null | true | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.title
- null/boolean - disable or enable axis title.
- string - sets axis title text value.
- object - sets axis title settings.
Params:
Name | Type | Default | Description |
---|---|---|---|
settings | null | boolean | Object | string | false | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.width
Returns:
number | string | null - Axis width.var yAxis = chart.yAxis(); var axisWidth = yAxis.width();
Params:
Name | Type | Default | Description |
---|---|---|---|
width | number | string | null | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it:
zIndex
Params:
Name | Type | Default | Description |
---|---|---|---|
zIndex | number | 0 | Value to set. |
Returns:
anychart.standalones.axes.Linear - Self instance for method chaining.Try it: