class anychart.core.axes.LinearGauge Improve this Doc
Extends: anychart.core.axes.Linear
Linear Gauge axis class.
Any axis must be bound to a scale.
To obtain a new instance of Axis use anychart.standalones.axes#linear.
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. |
offset() | Offset settings |
orientation() | Axis orientation. |
padding() | Padding settings for the linear axis. |
width() | Axis width. |
zIndex() | Z-index of the element. |
Methods Description
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.core.axes.LinearGauge - 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.core.axes.LinearGauge - 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.core.axes.LinearGauge - 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 | Labels settings to set. |
Returns:
anychart.core.axes.LinearGauge - 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.core.axes.LinearGauge - 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.core.axes.LinearGauge - Self instance for method chaining.offset
Params:
Name | Type | Description |
---|---|---|
offset | string | Percent offset. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it:
orientation
Returns:
anychart.enums.Orientation | string - Axis orientation.var axis = gauge.axis(); var orientation = axis.orientation();
Params:
Name | Type | Default | Description |
---|---|---|---|
orientation | anychart.enums.Orientation | string | 'left' | Axis orientation to set. |
Returns:
anychart.core.axes.LinearGauge - 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.core.axes.LinearGauge - 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.core.axes.LinearGauge - 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.core.axes.LinearGauge - 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:
scale
Returns:
anychart.scales.Base - Axis scale.var axis = gauge.axis(); var scale = axis.scale();
Note: the scale() method should be used after drawing a chart.
Params:
Name | Type | Default | Description |
---|---|---|---|
settings | anychart.scales.Base | Object | anychart.enums.ScaleTypes | string | anychart.scales.Linear | Scale settings to set. |
Returns:
anychart.core.axes.LinearGauge - 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.core.axes.LinearGauge - 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.core.axes.LinearGauge - 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.core.axes.LinearGauge - Self instance for method chaining.Try it:
stroke
Returns:
anychart.graphics.vector.Stroke - Axis stroke settings.var axis = gauge.axis(); var stroke = axis.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.core.axes.LinearGauge - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
settings | Object | Object with stroke settings from anychart.graphics.vector.Stroke |
Returns:
anychart.core.axes.LinearGauge - 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.core.axes.LinearGauge - 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.core.axes.LinearGauge - Self instance for method chaining.width
Returns:
number | string | null - Axis width.var axis = gauge.axis(); var width = axis.width();
Params:
Name | Type | Default | Description |
---|---|---|---|
width | number | string | null | Axis width to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it:
zIndex
Params:
Name | Type | Default | Description |
---|---|---|---|
zIndex | number | 0 | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it: