You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Enable label on ellipse annotation
* adds label reference in ellipse element
* adds test cases
* adds types
* adds documentation
* adds samples
* Add element diagrams to the annotation types guide
* fixes lint
* fixes CC similar code
* back to similar code
Namespace: `options.annotations[annotationID].label`, it defines options for the the label of annotation.
4
+
5
+
All of these options can be [Scriptable](../options#scriptable-options)
6
+
7
+
| Name | Type | Default | Notes
8
+
| ---- | ---- | :----: | ----
9
+
| `color` | [`Color`](../options#color) | `'black'` | Text color.
10
+
| `content` | `string`\|`string[]`\|[`Image`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image)\|[`HTMLCanvasElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement) | `null` | The content to show in the label.
11
+
| `display` | `boolean` | `false` | Whether or not the label is shown.
12
+
| `drawTime` | `string` | `options.drawTime` | See [drawTime](../options#draw-time). Defaults to the annotation draw time if unset
| `height` | `number`\|`string` | `undefined` | Overrides the height of the image or canvas element. Could be set in pixel by a number, or in percentage of current height of image or canvas element by a string. If undefined, uses the height of the image or canvas element. It is used only when the content is an image or canvas element.
15
+
| `padding` | [`Padding`](../options#padding) | `6` | The padding to add around the text label.
16
+
| [`position`](#position) | `string`\|`{x: string, y: string}` | `'center'` | Anchor position of label in the annotation.
17
+
| `rotation` | `number` | `undefined` | Rotation of label, in degrees. If `undefined`, the annotation rotation is used.
18
+
| `textAlign` | `string` | `'start'` | Text alignment of label content when there's more than one line. Possible options are: `'left'`, `'start'`, `'center'`, `'end'`, `'right'`.
19
+
| `textStrokeColor` | [`Color`](../options#color) | `undefined` | The color of the stroke around the text.
20
+
| `textStrokeWidth` | `number` | `0` | Stroke width around the text.
21
+
| `width` | `number`\|`string` | `undefined` | Overrides the width of the image or canvas element. Could be set in pixel by a number, or in percentage of current width of image or canvas element by a string. If undefined, uses the width of the image or canvas element. It is used only when the content is an image or canvas element.
22
+
| `xAdjust` | `number` | `0` | Adjustment along x-axis (left-right) of label relative to computed position. Negative values move the label left, positive right.
23
+
| `yAdjust` | `number` | `0` | Adjustment along y-axis (top-bottom) of label relative to computed position. Negative values move the label up, positive down.
24
+
| `z` | `number` | `0` | It determines the drawing stack level of the label element, with same `drawTime`.
25
+
26
+
### Position
27
+
28
+
A position can be set in 2 different values types:
29
+
30
+
1.`'start'`, `'center'`, `'end'` which are defining where the label will be located
31
+
2. a `string`, in percentage format `'number%'`, is representing the percentage on the size where the label will be located
32
+
33
+
If this value is a string (possible options are `'start'`, `'center'`, `'end'` or a string in percentage format), it is applied to vertical and horizontal position in the annotation.
34
+
35
+
If this value is an object, the `x` property defines the horizontal alignment in the annotation. Similarly, the `y` property defines the vertical alignment in the annotation. Possible options for both properties are `'start'`, `'center'`, `'end'`, a string in percentage format. Omitted property have value of the default, `'center'`.
Copy file name to clipboardExpand all lines: docs/guide/types/box.md
+1-35Lines changed: 1 addition & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,41 +104,7 @@ If one of the axes does not match an axis in the chart, the box will take the en
104
104
105
105
If this value is a number, it is applied to all corners of the rectangle (topLeft, topRight, bottomLeft, bottomRight). If this value is an object, the `topLeft` property defines the top-left corners border radius. Similarly, the `topRight`, `bottomLeft`, and `bottomRight` properties can also be specified. Omitted corners have radius of 0.
106
106
107
-
## Label
108
-
109
-
Namespace: `options.annotations[annotationID].label`, it defines options for the box annotation label.
110
-
111
-
All of these options can be [Scriptable](../options#scriptable-options)
112
-
113
-
| Name | Type | Default | Notes
114
-
| ---- | ---- | :----: | ----
115
-
| `color` | [`Color`](../options#color) | `'black'` | Text color.
116
-
| `content` | `string`\|`string[]`\|[`Image`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image)\|[`HTMLCanvasElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement) | `null` | The content to show in the label.
117
-
| `display` | `boolean` | `false` | Whether or not the label is shown.
118
-
| `drawTime` | `string` | `options.drawTime` | See [drawTime](../options#draw-time). Defaults to the box annotation draw time if unset
| `height` | `number`\|`string` | `undefined` | Overrides the height of the image or canvas element. Could be set in pixel by a number, or in percentage of current height of image or canvas element by a string. If undefined, uses the height of the image or canvas element. It is used only when the content is an image or canvas element.
121
-
| `padding` | [`Padding`](../options#padding) | `6` | The padding to add around the text label.
122
-
| [`position`](#position) | `string`\|`{x: string, y: string}` | `'center'` | Anchor position of label in the box.
123
-
| `rotation` | `number` | `undefined` | Rotation of label, in degrees. If `undefined`, the box rotation is used.
124
-
| `textAlign` | `string` | `'start'` | Text alignment of label content when there's more than one line. Possible options are: `'left'`, `'start'`, `'center'`, `'end'`, `'right'`.
125
-
| `textStrokeColor` | [`Color`](../options#color) | `undefined` | The color of the stroke around the text.
126
-
| `textStrokeWidth` | `number` | `0` | Stroke width around the text.
127
-
| `width` | `number`\|`string` | `undefined` | Overrides the width of the image or canvas element. Could be set in pixel by a number, or in percentage of current width of image or canvas element by a string. If undefined, uses the width of the image or canvas element. It is used only when the content is an image or canvas element.
128
-
| `xAdjust` | `number` | `0` | Adjustment along x-axis (left-right) of label relative to computed position. Negative values move the label left, positive right.
129
-
| `yAdjust` | `number` | `0` | Adjustment along y-axis (top-bottom) of label relative to computed position. Negative values move the label up, positive down.
130
-
| `z` | `number` | `0` | It determines the drawing stack level of the label element, with same `drawTime`.
131
-
132
-
### Position
133
-
134
-
A position can be set in 2 different values types:
135
-
136
-
1.`'start'`, `'center'`, `'end'` which are defining where the label will be located
137
-
2. a `string`, in percentage format `'number%'`, is representing the percentage on the size where the label will be located
138
-
139
-
If this value is a string (possible options are `'start'`, `'center'`, `'end'` or a string in percentage format), it is applied to vertical and horizontal position in the box.
140
-
141
-
If this value is an object, the `x` property defines the horizontal alignment in the box. Similarly, the `y` property defines the vertical alignment in the box. Possible options for both properties are `'start'`, `'center'`, `'end'`, a string in percentage format. Omitted property have value of the default, `'center'`.
@@ -93,6 +94,8 @@ If one of the axes does not match an axis in the chart, the ellipse will take th
93
94
| `shadowOffsetX` | The distance that shadow will be offset horizontally. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowOffsetX).
94
95
| `shadowOffsetY` | The distance that shadow will be offset vertically. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowOffsetY).
95
96
97
+
!!!include(./guide/types/_commonInnerLabel.md)!!!
98
+
96
99
## Element
97
100
98
101
The following diagram is showing the element properties about a `'ellipse'` annotation:
0 commit comments