AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.standalones.axisMarkers.Range Improve this Doc

Extends: anychart.core.axisMarkers.Range

The Range class contains methods for configuring standalones range markers.

Methods Overview

Axes and Scales
axis()Axis settings.
scale()Scale settings.
scaleRangeMode()Scale range mode.
Coloring
fill()Fill 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
from()Starting range marker value.
isHorizontal()Whether a range marker has horizontal layout.
layout()Layout settings.
parentBounds()Parent bounds for the range marker.
to()Ending range marker value.
zIndex()Z-index of the element.
Miscellaneous
container()Container for the range marker.
draw()Drawing of the range marker.

Methods Description

axis

Getter for the range marker axis.

Returns:

anychart.core.axes.Linear - The range marker axis.
Setter for the range marker axis.

Params:

NameTypeDefaultDescription
axisanychart.core.axes.Linear
null
Axis instance to set.

Returns:

anychart.core.axisMarkers.Line - Self instance for method chaining.

container

Getter for the range marker container.

Returns:

anychart.graphics.vector.Layer | anychart.graphics.vector.Stage - The range marker container.
Setter for the range marker container.

Params:

NameTypeDescription
elementanychart.graphics.vector.Layer | anychart.graphics.vector.Stage | string | ElementThe value to set.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.

draw

Drawing of the range marker.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.

enabled

Getter for the element state (enabled or disabled).

Returns:

boolean - Element state.
Setter for the element enabled state.

Params:

NameTypeDefaultDescription
enabledboolean
true
Enabled state to set.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.
Example.
if (!element.enabled())
   element.enabled(true);

fill

Getter for the range marker fill.

Returns:

anychart.graphics.vector.Fill - Range marker settings.
See listing
var rangeMarkerSettings = chart.rangeMarker();
var fill = rangeMarkerSettings.fill();
Setter for fill settings using an array, an object or a string. Learn more about coloring.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Fill | Array.<(anychart.graphics.vector.GradientKey|string)>
{color: '#c1c1c1', opacity: 0.4}
Color as an object, an array or a string.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.
Fill color with opacity. Fill as a string or an object.

Params:

NameTypeDefaultDescription
colorstring
'#c1c1c1'
Color as a string.
opacitynumber
0.4
Color opacity.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.
Linear gradient fill. Learn more about coloring.

Params:

NameTypeDescription
keysArray.<(anychart.graphics.vector.GradientKey|string)>Gradient keys.
anglenumberGradient angle.
modeboolean | anychart.graphics.vector.Rect | ObjectGradient mode.
opacitynumberGradient opacity.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.
Radial gradient fill. Learn more about coloring.

Params:

NameTypeDescription
keysArray.<(anychart.graphics.vector.GradientKey|string)>Color-stop gradient keys.
cxnumberX ratio of center radial gradient.
cynumberY ratio of center radial gradient.
modeanychart.graphics.math.RectIf defined then userSpaceOnUse mode, else objectBoundingBox.
opacitynumberOpacity of the gradient.
fxnumberX ratio of focal point.
fynumberY ratio of focal point.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.

Params:

NameTypeDescription
imageSettingsanychart.graphics.vector.FillObject with settings.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.

from

Getter for the starting range marker value.

Returns:

number - The starting range marker value.
See listing
var rangeMarkerSettings = chart.rangeMarker();
var startingValue = rangeMarkerSettings.from();
Setter for the starting range marker value.

Params:

NameTypeDefaultDescription
fromValuenumber
0
'From' value to set.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.

isHorizontal

Whether a range marker has horizontal layout. Layout is define by anychart.core.axisMarkers.Range#layout method.

Returns:

boolean - Returns true if the range marker's layout is horizontal.

layout

Getter for the range marker layout.

Returns:

anychart.enums.Layout | string - The range marker layout.
Setter for the range marker layout.

Params:

NameTypeDefaultDescription
layoutanychart.enums.Layout | string
'horizontal'
Range marker layout.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.

listen

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
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
}
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

listenOnce

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

parentBounds

Getter for bounds.

Returns:

anychart.math.Rect - The range marker bounds.
Setter for bounds using single value.

Params:

NameTypeDescription
boundsanychart.math.Rect | Object | nullBounds to set

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.
Setter for bounds using several values.

Params:

NameTypeDescription
leftnumberLeft space
topnumberTop space
widthnumberWidth line marker
heightnumberHeight line marker

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.

print

Prints all elements on related stage.

Params:

NameTypeDefaultDescription
paperSizeOrOptionsanychart.graphics.vector.PaperSize | Object
Paper size or object with options.
landscapeboolean
false
Flag of landscape.

removeAllListeners

Removes all listeners from an object. You can also optionally remove listeners of some particular type.

Params:

NameTypeDescription
typestringType of event to remove, default is to remove all types.

Returns:

number - Number of listeners removed.

scale

Getter for the range marker scale.

Returns:

anychart.scales.Base - The range marker scale.
Setter for the range marker scale.

Params:

NameTypeDefaultDescription
settingsanychart.scales.Base | Object | anychart.enums.ScaleTypes | string
anychart.scales.Linear
Scale settings to set.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.

scaleRangeMode

Getter for the scale range mode.

Returns:

string - Scale range mode.
See listing
var rangeMarker = chart.rangeMarker();
var scaleRangeMode = rangeMarker.scaleRangeMode();
Setter for the scale range mode.
Whether to consider the range marker value in the scale calculation or not. The 'consider' mode consideres the marker value in the scale.

Params:

NameTypeDefaultDescription
modestring | anychart.enums.ScaleRangeMode
'none'
Mode to set.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.

to

Getter for the ending range marker value.

Returns:

number - The ending range marker value.
See listing
var rangeMarkerSettings = chart.rangeMarker();
var endingValue = rangeMarkerSettings.to();
Setter for the ending range marker value.

Params:

NameTypeDefaultDescription
toValuenumber
0
'To' value to set.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.

unlisten

Removes a listener added using listen() or listenOnce() methods.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object):boolean|undefined
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

boolean - Whether any listener was removed.

unlistenByKey

Removes an event listener which was added with listen() by the key returned by listen() or listenOnce().

Params:

NameTypeDescription
keyObjectThe key returned by listen() or listenOnce().

Returns:

boolean - Whether any listener was removed.

zIndex

Getter for the Z-index of the element.

Returns:

number - Z-index.
Setter for the Z-index of the element.

Params:

NameTypeDefaultDescription
zIndexnumber
0
Value to set.

Returns:

anychart.standalones.axisMarkers.Range - Self instance for method chaining.