# Box Annotations
Box annotations are used to draw rectangles on the chart area. This can be useful for highlighting different areas of a chart.
# Configuration
The following options are available for box annotations.
Name | Type | Scriptable | Default |
---|---|---|---|
display | boolean | Yes | true |
adjustScaleRange | boolean | Yes | true |
drawTime | string | Yes | 'afterDatasetsDraw' |
xScaleID | string | Yes | 'x' |
yScaleID | string | Yes | 'y' |
xMin | number | Yes | undefined |
xMax | number | Yes | undefined |
yMin | number | Yes | undefined |
YMax | number | Yes | undefined |
borderColor | Color | Yes | options.color |
borderWidth | number | Yes | 1 |
borderDash | number[] | Yes | [] |
borderDashOffset | number | Yes | 0 |
backgroundColor | Color | Yes | options.color |
cornerRadius | number | Yes | 0 |
# General
If one of the axes does not match an axis in the chart, the box will take the entire chart dimension. The 4 coordinates, xMin, xMax, yMin, yMax are optional. If not specified, the box is expanded out to the edges in the respective direction.
Name | Description |
---|---|
display | Whether or not this annotation is visible |
adjustScaleRange | Should the scale range be adjusted if this annotation is out of range |
drawTime | See drawTime |
xScaleID | ID of the X scale to bind onto, default is 'x'. |
yScaleID | ID of the Y scale to bind onto, default is 'y'. |
xMin | Left edge of the box in units along the x axis. |
xMax | Right edge of the box in units along the x axis. |
yMin | Top edge of the box in units along the y axis. |
yMax | Bottom edge of the box in units along the y axis. |
# Styling
Name | Description |
---|---|
borderColor | Stroke color |
borderWidth | Stroke width |
borderDash | Length and spacing of dashes. See MDN (opens new window). |
borderDashOffset | Offset for line dashes. See MDN (opens new window). |
backgroundColor | Fill color |
cornerRadius | Radius of box rectangle |