class anychart.core.annotations.Rectangle Improve this Doc
Extends: anychart.core.annotations.Base
Rectangle annotation.
Methods Overview
| Specific settings | |
| getPlot() | Returns the plot on which the annotation is drawn. |
| getType() | Returns annotation type. |
| markers() | Markers settings. |
| Axes and Scales | |
| xScale() | X-scale settings |
| yScale() | Y-scale settings |
| Charts | |
| getChart() | Returns the chart on which the annotation is drawn. |
| Coloring | |
| color() | Color settings. |
| fill() | Fill settings. |
| hatchFill() | Hatch fill settings. |
| stroke() | Stroke settings. |
| Interactivity | |
| allowEdit() | Interactivity settings. |
| enabled() | Element state (enabled or disabled). |
| hovered() | Hovered state settings. |
| normal() | Normal state settings. |
| select() | Selects current annotation. |
| selected() | Selected state settings. |
| Size and Position | |
| bottom() | Bottom bound settings. |
| bounds() | Bounds settings. |
| getPixelBounds() | Returns pixel bounds. |
| height() | Height settings. |
| hoverGap() | Hover gap settings. |
| left() | Left bound settings. |
| maxHeight() | Maximum height. |
| maxWidth() | Maximum width. |
| minHeight() | Minimum height. |
| minWidth() | Minimum width. |
| right() | Right bound settings. |
| secondValueAnchor() | Second value anchor settings |
| secondXAnchor() | Second X anchor settings |
| top() | Top bound settings. |
| valueAnchor() | Value anchor settings |
| width() | Width settings. |
| xAnchor() | X anchor settings |
| zIndex() | Z-index of the element. |
Methods Description
allowEdit
Returns:
boolean - Interactivity settings.var allowEdit = annotation.allowEdit();
Params:
| Name | Type | Description |
|---|---|---|
| value | * | Whether to disable the interactivity in the annotation. If set to false, the interactivity is disabled in the annotation. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
bottom
Returns:
number | string | undefined - Element's bottom bound setting.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| bottom | number | string | null | null | Bottom bound settings for the element. |
Returns:
anychart.core.annotations.Rectangle - Returns self for method chaining.Try it:
bounds
Returns:
anychart.core.utils.Bounds - Bounds of the element.Params:
| Name | Type | Description |
|---|---|---|
| bounds | anychart.utils.RectObj | anychart.math.Rect | anychart.core.utils.Bounds | Bounds of element. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
Params:
| Name | Type | Default | Description |
|---|---|---|---|
| x | number | string | null | X-coordinate. |
| y | number | string | null | Y-coordinate. |
| width | number | string | null | Width. |
| height | number | string | null | Height. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
color
Returns:
string - The annotation color.var color = annotation.color();
Learn more about coloring.
Params:
| Name | Type | Description |
|---|---|---|
| color | string | Color as a string. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
enabled
Returns:
boolean - Element state.Try it:
Params:
| Name | Type | Default | Description |
|---|---|---|---|
| enabled | boolean | true | Enabled state to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.if (!element.enabled()) element.enabled(true);
Try it:
fill
Returns:
anychart.graphics.vector.Fill - The annotation fill color.var fill = annotation.fill();
Params:
| Name | Type | Description |
|---|---|---|
| color | anychart.graphics.vector.Fill | Array.<(anychart.graphics.vector.GradientKey|string)> | Color as an array, an object or a string. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| fillFunction | function():anychart.graphics.vector.Fill | function() {
return anychart.color.darken(this.sourceColor);
} | Function that looks like: function(){
// this.index - series index.
// this.sourceColor - color returned by fill() getter.
// this.iterator - series point iterator.
return fillValue; // type anychart.graphics.vector.Fill
} |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
Params:
| Name | Type | Description |
|---|---|---|
| color | string | Color as a string. |
| opacity | number | Color opacity (0 to 1). |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
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.annotations.Rectangle - Self instance for method chaining.Try it:
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.annotations.Rectangle - Self instance for method chaining.Try it:
Params:
| Name | Type | Description |
|---|---|---|
| imageSettings | anychart.graphics.vector.Fill | Object with settings. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
getChart
Returns:
anychart.core.SeparateChart - Chart.Try it:
getPixelBounds
Returns:
anychart.math.Rect - Pixel bounds of the element.getPlot
Returns:
anychart.core.stock.Plot - Stock plot.Try it:
getType
hatchFill
Returns:
anychart.graphics.vector.PatternFill | anychart.graphics.vector.HatchFill | function - Hatch fill settings.var hatchFill = annotation.hatchFill();
Params:
| Name | Type | Default | Description |
|---|---|---|---|
| type | anychart.graphics.vector.HatchFill.HatchFillType | string | false | Type of hatch fill. |
| color | string | Color. | |
| thickness | number | Thickness. | |
| size | number | Pattern size. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
Params:
| Name | Type | Description |
|---|---|---|
| hatchFillFunction | function | HatchFill function. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
Params:
| Name | Type | Description |
|---|---|---|
| patternFill | anychart.graphics.vector.PatternFill | Pattern fill to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
Params:
| Name | Type | Description |
|---|---|---|
| settings | anychart.graphics.vector.HatchFill | Hatch fill instance. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
Params:
| Name | Type | Default | Description |
|---|---|---|---|
| enabled | boolean | false | Whether to enable hatch fill or no. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
height
Returns:
number | string | undefined - Element's height setting.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| height | number | string | null | null | Height settings for the element. |
Returns:
anychart.core.annotations.Rectangle - Returns self for method chaining.Try it:
hoverGap
Returns:
number - The hover gap value.var hoverGap = annotation.hoverGap();
The contour size around annotation.
Params:
| Name | Type | Description |
|---|---|---|
| value | * | Value to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
hovered
Returns:
anychart.core.StateSettings - Hovered state settingsTry it:
Params:
| Name | Type | Description |
|---|---|---|
| settings | Object | State settings to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
left
Returns:
number | string | undefined - Element's left bound setting.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| left | number | string | null | null | Left bound setting for the element. |
Returns:
anychart.core.annotations.Rectangle - Returns self for method chaining.Try it:
markers
- null/boolean - disable or enable annotation markers.
- object - sets annotation markers settings.
- string - sets annotation markers type.
Params:
| Name | Type | Default | Description |
|---|---|---|---|
| settings | Object | boolean | null | string | false | Data markers settings. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.maxHeight
Returns:
number | string | null - Element's maximum height.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| height | number | string | null | null | Maximum height to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
maxWidth
Returns:
number | string | null - Element's maximum width.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| width | number | string | null | null | Maximum width to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
minHeight
Returns:
number | string | null - Element's minimum height.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| height | number | string | null | null | Minimum height to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
minWidth
Returns:
number | string | null - Element's minimum width.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| width | number | string | null | null | Minimum width to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
normal
Returns:
anychart.core.StateSettings - Normal state settings.Try it:
Params:
| Name | Type | Description |
|---|---|---|
| settings | Object | State settings to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
right
Returns:
number | string | undefined - Element's right bound setting.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| right | number | string | null | null | Right bound setting for the element. |
Returns:
anychart.core.annotations.Rectangle - Returns self for method chaining.Try it:
secondValueAnchor
Returns:
* - The second value anchor.var controller = chart.annotations(); var annotation = controller.rectangle(); var secondValueAnchor = annotation.secondValueAnchor();
Params:
| Name | Type | Description |
|---|---|---|
| value | * | Second value anchor to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
secondXAnchor
Returns:
* - The second X anchor.var controller = chart.annotations(); var annotation = controller.rectangle(); var secondXAnchor = annotation.secondXAnchor();
Params:
| Name | Type | Description |
|---|---|---|
| value | * | Second X anchor to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
select
Try it:
selected
Returns:
anychart.core.StateSettings - Selected state settingsTry it:
Params:
| Name | Type | Description |
|---|---|---|
| settings | Object | State settings to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
stroke
Returns:
anychart.graphics.vector.Stroke - Stroke settings.var stroke = annotation.stroke();
Params:
| Name | Type | Default | Description |
|---|---|---|---|
| strokeFunction | function():anychart.graphics.vector.Stroke|anychart.graphics.vector.ColoredFill | function() {
return anychart.color.darken(this.sourceColor);
} | Function that looks like: function(){
// this.index - series index.
// this.sourceColor - color returned by fill() getter.
// this.iterator - series point iterator.
return strokeValue; // type anychart.graphics.vector.Stroke or anychart.graphics.vector.ColoredFill
} |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.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 | string | anychart.graphics.vector.StrokeLineJoin | Line join style. | |
| lineCap | string | anychart.graphics.vector.StrokeLineCap | Line cap style. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
Params:
| Name | Type | Description |
|---|---|---|
| settings | Object | Object with stroke settings from anychart.graphics.vector.Stroke |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
top
Returns:
number | string | undefined - Element's top bound setting.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| top | number | string | null | null | Top bound setting for the element. |
Returns:
anychart.core.annotations.Rectangle - Returns self for method chaining.Try it:
valueAnchor
Returns:
* - The value anchor.var controller = chart.annotations(); var annotation = controller.rectangle(); var valueAnchor = annotation.valueAnchor();
Params:
| Name | Type | Description |
|---|---|---|
| value | * | Value anchor to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
width
Returns:
number | string | undefined - Element's width setting.Params:
| Name | Type | Default | Description |
|---|---|---|---|
| width | number | string | null | null | Width settings for the element. |
Returns:
anychart.core.annotations.Rectangle - Returns self for method chaining.Try it:
xAnchor
Returns:
* - The X anchor.var controller = chart.annotations(); var annotation = controller.rectangle(); var xAnchor = annotation.xAnchor();
Params:
| Name | Type | Description |
|---|---|---|
| value | * | X anchor to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
xScale
Returns:
anychart.scales.Ordinal | anychart.scales.Linear | anychart.scales.Logarithmic | anychart.scales.StockScatterDateTime - Default scale value.Try it:
Params:
| Name | Type | Default | Description |
|---|---|---|---|
| settings | anychart.scales.Base | anychart.scales.StockScatterDateTime | Object | anychart.enums.ScaleTypes | string | anychart.scales.Linear | Value to set |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
yScale
Params:
| Name | Type | Default | Description |
|---|---|---|---|
| settings | anychart.scales.Base | Object | anychart.enums.ScaleTypes | string | anychart.scales.Linear | Y-scale to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
zIndex
Params:
| Name | Type | Default | Description |
|---|---|---|---|
| zIndex | number | 0 | Value to set. |
Returns:
anychart.core.annotations.Rectangle - Self instance for method chaining.Try it:
