AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated v7 version of this document. Switch to the v8 version to see the up to date information.

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.

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
valueanychart.scales.LinearColor | anychart.scales.OrdinalColorColor scale.

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 or a string. Learn more about coloring.

Params:

NameTypeDescription
valueanychart.graphics.vector.FillColor as an object 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
valuestring | numberValue 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
valuestring
"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
valueArray.<anychart.core.linearGauge.ScaleBar.ControlPoint>Points.

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:

NameTypeDescription
valueanychart.scales.BaseScale.

Returns:

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

stroke

Getter for stroke settings.

Returns:

anychart.graphics.vector.Stroke - Stroke settings.

Params:

NameTypeDefaultDescription
coloranychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
Stroke settings.
thicknessnumber
1
Line thickness.
dashpatternstring
Controls the pattern of dashes and gaps used to stroke paths.
lineJoinanychart.graphics.vector.StrokeLineJoin
Line join style.
lineCapanychart.graphics.vector.StrokeLineCap
Line cap style.

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
valuestring | numberValue 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
valuestring
"10%"
Width in pixel or percent.

Returns:

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