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. |
Events | |
listen() | Adds an event listener. |
listenOnce() | Adds a single time event listener. |
removeAllListeners() | Removes all listeners. |
unlisten() | Removes the listener. |
unlistenByKey() | Removes the listener by the key. |
Export | |
print() | Prints all elements. |
Interactivity | |
enabled() | Element state (enabled or disabled). |
Size and Position | |
getRemainingBounds() | Returns remaining parent bounds to use elsewhere. |
isHorizontal() | Whether an axis is horizontal. |
offset() | Offset settings |
orientation() | Axis orientation. |
width() | Axis width. |
zIndex() | Z-index of the element. |
Methods Description
drawFirstLabel
Returns:
boolean - Drawing flag.var currentAxis = chart.yAxis(); var flag = currentAxis.drawFirstLabel();
Params:
Name | Type | Default | Description |
---|---|---|---|
value | boolean | true | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it:
drawLastLabel
Returns:
boolean - Drawing flag.var currentAxis = chart.yAxis(); var flag = currentAxis.drawLastLabel();
Params:
Name | Type | Default | Description |
---|---|---|---|
value | boolean | true | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it:
enabled
Returns:
boolean - The current element state.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | boolean | true | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.if (!element.enabled()) element.enabled(true);
Try it:
getRemainingBounds
Returns:
anychart.math.Rect - Parent bounds without the space used by the title.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 |
---|---|---|---|
value | Object | boolean | null | true | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.listen
Note Notice that if the existing listener is one-off (added using listenOnce), it will cease to be such after calling the listen() method.
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. Function that looks like function(event){
// event.actualTarget - actual event target
// event.currentTarget - current event target
// event.iterator - event iterator
// event.originalEvent - original event
// event.point - event point
// event.pointIndex - event point index
} . | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
Object - Unique key for the listener.Try it:
listenOnce
If the event handler being added already exists, listenOnce will do nothing.
Note In particular, if the handler is already registered using listen(), listenOnce() will not make it one-off. Similarly, if a one-off listener already exists, listenOnce will not change it (it wil remain one-off).
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
Object - Unique key for the listener.Try it:
minorLabels
- null/boolean - disable or enable axis minor labels.
- object - sets axis minor labels settings.
Params:
Name | Type | Default | Description |
---|---|---|---|
value | 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 |
---|---|---|---|
value | Object | boolean | null | false | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.offset
Params:
Name | Type | Description |
---|---|---|
value | string | Percent offset. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it:
orientation
Returns:
anychart.enums.Orientation - Axis orientation.var currentAxis = chart.yAxis(); var axisOrientation = currentAxis.orientation();
Params:
Name | Type | Default | Description |
---|---|---|---|
value | string | anychart.enums.Orientation | "top" | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it:
overlapMode
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.enums.LabelsOverlapMode | string | "noOverlap" | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
paperSizeOrOptions | anychart.graphics.vector.PaperSize | Object | Paper size or object with options. | |
landscape | boolean | false | Flag of landscape. |
Try it:
removeAllListeners
Params:
Name | Type | Description |
---|---|---|
type | string | Type of event to remove, default is to remove all types. |
Returns:
number - Number of listeners removed.Try it:
scale
Returns:
anychart.scales.Base - Axis scale.var currentAxis = chart.yAxis(); var axisScale = currentAxis.scale();
Params:
Name | Type | Description |
---|---|---|
value | anychart.scales.Base | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it:
staggerLines
Returns:
number - Stagger line settings.var currentAxis = chart.yAxis(); var lines = currentAxis.staggerLines();
Note: pass null to enable autocalculation.
Params:
Name | Type | Default | Description |
---|---|---|---|
value | 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 currentAxis = chart.yAxis(); var maxLines = currentAxis.staggerMaxLines();
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.core.axes.LinearGauge - Self instance for method chaining.Try it:
staggerMode
Returns:
boolean - Stagger mode state.var currentAxis = chart.yAxis(); var flag = currentAxis.staggerMode();
Params:
Name | Type | Default | Description |
---|---|---|---|
value | 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 currentAxis = chart.yAxis(); var axisStroke = currentAxis.stroke();
Params:
Name | Type | Default | Description |
---|---|---|---|
value | 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 | anychart.graphics.vector.StrokeLineJoin | Line join style. | |
lineCap | anychart.graphics.vector.StrokeLineCap | Line cap style. |
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 |
---|---|---|---|
value | 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 |
---|---|---|---|
value | null | boolean | Object | string | false | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.unlisten
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
boolean - Whether any listener was removed.Try it:
unlistenByKey
Params:
Name | Type | Description |
---|---|---|
key | Object | The key returned by listen() or listenOnce(). |
Returns:
boolean - Whether any listener was removed.Try it:
width
Returns:
number | string | null - Axis width.var currentYAxis = chart.yAxis(); var axisWidth = currentYAxis.width();
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | string | null | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it:
zIndex
Returns:
number - The current zIndex.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | 0 | Value to set. |
Returns:
anychart.core.axes.LinearGauge - Self instance for method chaining.Try it: