Top
You are looking at an outdated 7.13.1 version of this document. Switch to the 8.0.1 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:

Name Type Description
value anychart.scales.LinearColor | anychart.scales.OrdinalColor Color scale.

Returns:

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

Try it:

fill

Getter for the scale bar fill color.

Returns:

anychart.graphics.vector.Fill - The fill color.

Try it:

Setter for fill settings using an array or a string. Learn more about coloring.

Params:

Name Type Description
value anychart.graphics.vector.Fill Color as an object or a string.

Returns:

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

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

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

Try it:

Linear gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

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

Try it:

Radial gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

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

Try it:

Params:

Name Type Description
imageSettings anychart.graphics.vector.Fill Object with settings.

Returns:

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

Try it:

from

Getter for the starting range value.

Returns:

string number - Starting range value.

Try it:

Setter for the starting range value.

Params:

Name Type Description
value string | number 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.

Try it:

offset

Getter for scale bar offset.

Returns:

string - The scale bar offset.

Try it:

Setter for scale bar offset.

Params:

Name Type Default Description
value string
"0%"
Offset value in percent.

Returns:

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

Try it:

points

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

Params:

Name Type Description
value Array.<anychart.core.linearGauge.ScaleBar.ControlPoint> Points.

Returns:

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

Try it:

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:

Name Type Description
value anychart.scales.Base Scale.

Returns:

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

Try it:

stroke

Getter for stroke settings.

Returns:

anychart.graphics.vector.Stroke - Stroke settings.

Try it:

Params:

Name Type Default Description
color anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null
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.linearGauge.ScaleBar - Self instance for method chaining.

Try it:

to

Getter for the ending range value.

Returns:

string number - Ending range value.

Try it:

Setter for the ending range value.

Params:

Name Type Description
value string | number 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.

Try it:

width

Getter for the scale bar width.

Returns:

string - Scale bar width.

Try it:

Setter for the scale bar width.

Params:

Name Type Default Description
value string
"10%"
Width in pixel or percent.

Returns:

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

Try it: