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:
Name | Type | Description |
---|---|---|
settings | anychart.scales.LinearColor | anychart.scales.OrdinalColor | Object | anychart.enums.ScaleTypes | string | Color scale settings. |
Returns:
anychart.core.linearGauge.ScaleBar - Self instance for method chaining.Try it:
fill
Getter for the scale bar fill color.
Detailed description
This method can be used as getter only if you have set its value.
Returns:
anychart.graphics.vector.Fill - The fill color.Try it:
Setter for fill settings using an array, an object or a string.
Learn more about coloring.
Params:
Name | Type | Description |
---|---|---|
color | anychart.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.
Detailed description
Note: If color is set as a string (e.g. 'red .5') it has a priority over opt_opacity, which
means: color set like this rect.fill('red 0.3', 0.7) will have 0.3 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:
Image fill.
Learn more about coloring.
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.
Detailed description
If set as string value will be treated as percent ('55%') or as 'min' or 'max'.
If set as an integer will be treated as value of scale. But will not extend scale.
Params:
Name | Type | Description |
---|---|---|
fromValue | string | 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.Try it:
offset
Setter for scale bar offset.
Params:
Name | Type | Default | Description |
---|---|---|---|
offset | string | '0%' | Offset value in percent. |
Returns:
anychart.core.linearGauge.ScaleBar - Self instance for method chaining.Try it:
points
Getter for points.
Returns:
Array.<anychart.core.linearGauge.ScaleBar.ControlPoint> - Points. See listing.
var scaleBar = chart.scaleBar(); var points = scaleBar.points();
Setter for points.
Params:
Name | Type | Description |
---|---|---|
pointsList | Array.<anychart.core.linearGauge.ScaleBar.ControlPoint> | Points to set. |
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 | Default | Description |
---|---|---|---|
scale | anychart.scales.Base | anychart.scales.Linear | Scale for the scale bar. |
Returns:
anychart.scales.Base - Self instance for method chaining.Try it:
stroke
Getter for stroke settings.
Detailed description
This method can be used as getter only if you have set its value.
Returns:
anychart.graphics.vector.Stroke - Stroke settings.Try it:
Setter for stroke settings.
Learn more about stroke settings.
Detailed description
If you first set the anychart.core.linearGauge.ScaleBar#fill or
anychart.core.linearGauge.ScaleBar#stroke color and then a anychart.core.linearGauge.ScaleBar#colorScale,
the priority will be given to the color set by anychart.core.linearGauge.ScaleBar#fill or anychart.core.linearGauge.ScaleBar#stroke.
Params:
Name | Type | Description |
---|---|---|
color | anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null | Stroke settings. |
thickness | number | Line thickness. |
dashpattern | string | Controls the pattern of dashes and gaps used to stroke paths. |
lineJoin | string | anychart.graphics.vector.StrokeLineJoin | Line join style. |
lineCap | string | anychart.graphics.vector.StrokeLineCap | Line cap style. |
Returns:
anychart.core.linearGauge.ScaleBar - Self instance for method chaining.Try it:
Setter for the grid stroke using an object.
Params:
Name | Type | Description |
---|---|---|
settings | Object | Stroke settings from anychart.graphics.vector.Stroke. |
Returns:
anychart.core.linearGauge.ScaleBar - Self instance for method chaining.Try it:
to
Setter for the ending range value.
Detailed description
If set as string value will be treated as percent ('55%') or as 'min' or 'max'.
If set as an integer will be treated as value of scale. But will not extend scale.
Params:
Name | Type | Description |
---|---|---|
toValue | string | 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.Try it:
width
Setter for the scale bar width.
Params:
Name | Type | Default | Description |
---|---|---|---|
width | string | '10%' | Width in pixel or percent. |
Returns:
anychart.core.linearGauge.ScaleBar - Self instance for method chaining.Try it:
zIndex
Setter for the Z-index of the element.
Detailed description
The bigger the index - the higher the element position is.
Params:
Name | Type | Default | Description |
---|---|---|---|
zIndex | number | 0 | Value to set. |
Returns:
anychart.core.linearGauge.ScaleBar - Self instance for method chaining.Try it: