AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.core.linearGauge.ScaleBar Improve this Doc

Extends: anychart.core.VisualBase

Base class for scale bar.

Methods Overview

Axes and Scales
colorScale()Color scale settings.
scale()Scale settings.
Coloring
fill()Fill settings.
stroke()Stroke settings.
Size and Position
from()Starting range value.
offset()Offset settings.
points()Points settings.
to()Ending range value.
width()Width settings.
zIndex()Z-index of the element.

Methods Description

colorScale

Getter for the color scale.
See listing
var scaleBar = chart.scaleBar();
var colorScale = scaleBar.colorScale();
Setter for the color scale.

Params:

NameTypeDescription
settingsanychart.scales.LinearColor | anychart.scales.OrdinalColor | Object | anychart.enums.ScaleTypes | stringColor scale settings.

Returns:

anychart.core.linearGauge.ScaleBar - Self instance for method chaining.

fill

Getter for the scale bar fill color.

Returns:

anychart.graphics.vector.Fill - The fill color.
Setter for fill settings using an array, an object or a string. Learn more about coloring.

Params:

NameTypeDescription
coloranychart.graphics.vector.Fill | Array.<(anychart.graphics.vector.GradientKey|string)>Color as an object, an array or a string.

Returns:

anychart.core.linearGauge.ScaleBar - Self instance for method chaining.
Fill color with opacity.

Params:

NameTypeDescription
colorstringColor as a string.
opacitynumberColor opacity.

Returns:

anychart.core.linearGauge.ScaleBar - 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.core.linearGauge.ScaleBar - 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.core.linearGauge.ScaleBar - Self instance for method chaining.

Params:

NameTypeDescription
imageSettingsanychart.graphics.vector.FillObject with settings.

Returns:

anychart.core.linearGauge.ScaleBar - Self instance for method chaining.

from

Getter for the starting range value.

Returns:

string | number - Starting range value.
Setter for the starting range value.

Params:

NameTypeDescription
fromValuestring | number'From' value to set. In case of string it can be 'max' or 'min'. In case of number - ratio (from 0 to 1).

Returns:

anychart.core.linearGauge.ScaleBar - Self instance for method chaining.

offset

Getter for scale bar offset.

Returns:

string - The scale bar offset.
Setter for scale bar offset.

Params:

NameTypeDefaultDescription
offsetstring
'0%'
Offset value in percent.

Returns:

anychart.core.linearGauge.ScaleBar - Self instance for method chaining.

points

Getter for points.
See listing.
var scaleBar = chart.scaleBar();
var points = scaleBar.points();
Setter for points.

Params:

NameTypeDescription
pointsListArray.<anychart.core.linearGauge.ScaleBar.ControlPoint>Points to set.

Returns:

anychart.core.linearGauge.ScaleBar - Self instance for method chaining.

scale

Getter for the scale bar scale.

Returns:

anychart.scales.Base - Scale bar scale.
See listing
var scaleBar = chart.scaleBar();
var scale = scaleBar.scale();
Setter for the scale bar scale.

Params:

NameTypeDefaultDescription
scaleanychart.scales.Base
anychart.scales.Linear
Scale for the scale bar.

Returns:

anychart.scales.Base - Self instance for method chaining.

stroke

Getter for stroke settings.

Returns:

anychart.graphics.vector.Stroke - Stroke settings.

Params:

NameTypeDescription
coloranychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | nullStroke settings.
thicknessnumberLine thickness.
dashpatternstringControls the pattern of dashes and gaps used to stroke paths.
lineJoinstring | anychart.graphics.vector.StrokeLineJoinLine join style.
lineCapstring | anychart.graphics.vector.StrokeLineCapLine cap style.

Returns:

anychart.core.linearGauge.ScaleBar - Self instance for method chaining.
Setter for the grid stroke using an object.

Params:

NameTypeDescription
settingsObjectStroke settings from anychart.graphics.vector.Stroke.

Returns:

anychart.core.linearGauge.ScaleBar - Self instance for method chaining.

to

Getter for the ending range value.

Returns:

string | number - Ending range value.
Setter for the ending range value.

Params:

NameTypeDescription
toValuestring | number'To' value to set. In case of string it can be 'max' or 'min'. In case of number - ratio (from 0 to 1).

Returns:

anychart.core.linearGauge.ScaleBar - Self instance for method chaining.

width

Getter for the scale bar width.

Returns:

string - Scale bar width.
Setter for the scale bar width.

Params:

NameTypeDefaultDescription
widthstring
'10%'
Width in pixel or percent.

Returns:

anychart.core.linearGauge.ScaleBar - Self instance for method chaining.

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.core.linearGauge.ScaleBar - Self instance for method chaining.