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.
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 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.Try it:
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 |
---|---|---|
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
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.
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 |
---|---|---|
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.
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 | 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
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 |
---|---|---|
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
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: