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
Add stroke width and color options to label text (#679)
* Add stroke width and color options to label text
* fixes CC
* uses strokeWidth to calculate label rect (not only TextMetrics).
* adds textStrokeJoinStyle option
* changes the stroke join style option description in the documentation
* fixes typo in the join style options documentation
* removes textStrokeJoinStyle option in favor to fixed 'round'
* Update src/helpers/helpers.canvas.js
Co-authored-by: Jukka Kurkela <[email protected]>
* Update src/helpers/helpers.canvas.js
Co-authored-by: Jukka Kurkela <[email protected]>
Co-authored-by: Jukka Kurkela <[email protected]>
Copy file name to clipboardExpand all lines: docs/guide/types/box.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,7 +103,7 @@ If one of the axes does not match an axis in the chart, the box will take the en
103
103
| `borderColor` | Stroke color.
104
104
| `borderDash` | Length and spacing of dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
105
105
| `borderDashOffset` | Offset for border line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
106
-
| `borderJoinStyle` | Border line joint style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
106
+
| `borderJoinStyle` | Border line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
107
107
| [`borderRadius`](#borderradius) | Radius of box rectangle (in pixels).
108
108
| `borderShadowColor` | The color of the border shadow. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowColor).
109
109
| `borderWidth` | Border line width (in pixels).
@@ -132,6 +132,8 @@ All of these options can be [Scriptable](../options#scriptable-options)
132
132
| `padding` | [`Padding`](../options#padding) | `6` | The padding to add around the text label.
133
133
| [`position`](#position) | `string`\|`{x: string, y: string}` | `'center'` | Anchor position of label in the box.
134
134
| `textAlign` | `string` | `'start'` | Text alignment of label content when there's more than one line. Possible options are: `'left'`, `'start'`, `'center'`, `'end'`, `'right'`.
135
+
| `textStrokeColor` | [`Color`](../options#color) | `undefined` | The color of the stroke around the text.
136
+
| `textStrokeWidth` | `number` | `0` | Stroke width around the text.
135
137
| `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.
136
138
| `xAdjust` | `number` | `0` | Adjustment along x-axis (left-right) of label relative to computed position. Negative values move the label left, positive right.
137
139
| `yAdjust` | `number` | `0` | Adjustment along y-axis (top-bottom) of label relative to computed position. Negative values move the label up, positive down.
@@ -128,14 +130,16 @@ The 4 coordinates, xMin, xMax, yMin, yMax are optional. If not specified, the bo
128
130
| `borderColor` | Stroke color.
129
131
| `borderDash` | Length and spacing of dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
130
132
| `borderDashOffset` | Offset for border line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
131
-
| `borderJoinStyle` | Border line joint style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
133
+
| `borderJoinStyle` | Border line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
132
134
| `borderShadowColor` | The color of the border shadow. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowColor).
133
135
| `borderWidth` | Stroke width (in pixels).
134
136
| `color` | Text color.
135
137
| `font` | Text font.
136
138
| `shadowBlur` | The amount of blur applied to shadow of the box where the label is located. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowBlur).
137
139
| `shadowOffsetX` | The distance that shadow, of the box where the label is located, will be offset horizontally. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowOffsetX).
138
140
| `shadowOffsetY` | The distance that shadow, of the box where the label is located, will be offset vertically. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowOffsetY).
141
+
| `textStrokeColor` | The color of the stroke around the text.
142
+
| `textStrokeWidth` | Stroke width around the text.
139
143
140
144
### Position
141
145
@@ -218,7 +222,7 @@ All of these options can be [Scriptable](../options#scriptable-options).
218
222
| `borderColor` | [`Color`](../options#color) | `undefined` | Stroke color of the pointer of the callout.
219
223
| `borderDash` | `number[]` | `[]` | Length and spacing of dashes of callout. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
220
224
| `borderDashOffset` | `number` | `0` | Offset for line dashes of callout. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
221
-
| `borderJoinStyle` | `string` | `'miter'` | Border line joint style of the callout. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
225
+
| `borderJoinStyle` | `string` | `'miter'` | Border line join style of the callout. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
222
226
| `borderWidth` | `number` | `1` | Stroke width of the pointer of the callout.
223
227
| `enabled` | `boolean` | `false` | If true, the callout is drawn.
224
228
| `margin` | `number` | `5` | Amount of pixels between the label and the callout separator.
Copy file name to clipboardExpand all lines: docs/guide/types/line.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,7 +135,7 @@ All of these options can be [Scriptable](../options#scriptable-options)
135
135
| `borderColor` | [`Color`](../options#color) | `black` | The border line color.
136
136
| `borderDash` | `number[]` | `[]` | Length and spacing of dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
137
137
| `borderDashOffset` | `number` | `0` | Offset for border line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
138
-
| `borderJoinStyle` | `string` | `'miter'` | Border line joint style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
138
+
| `borderJoinStyle` | `string` | `'miter'` | Border line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
139
139
| [`borderRadius`](#borderradius) | `number`\|`object` | `6` | Radius of label box corners in pixels.
140
140
| `borderShadowColor` | [`Color`](../options#color) | `'transparent'` | The color of border shadow of the box where the label is located. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowColor).
141
141
| `borderWidth` | `number` | `0` | The border line width (in pixels).
@@ -152,6 +152,8 @@ All of these options can be [Scriptable](../options#scriptable-options)
152
152
| `shadowOffsetX` | `number` | `0` | The distance that shadow, of the box where the label is located, will be offset horizontally. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowOffsetX).
153
153
| `shadowOffsetY` | `number` | `0` | The distance that shadow, of the box where the label is located, will be offset vertically. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowOffsetY).
154
154
| `textAlign` | `string` | `'center'` | Text alignment of label content when there's more than one line. Possible options are: `'start'`, `'center'`, `'end'`.
155
+
| `textStrokeColor` | [`Color`](../options#color) | `undefined` | The color of the stroke around the text.
156
+
| `textStrokeWidth` | `number` | `0` | Stroke width around the text.
155
157
| `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.
156
158
| `xAdjust` | `number` | `0` | Adjustment along x-axis (left-right) of label relative to computed position. Negative values move the label left, positive right.
157
159
| `xPadding` | `number` | `6` | Padding of label to add left/right. This is **deprecated**. Use `padding`.
Copy file name to clipboardExpand all lines: docs/guide/types/polygon.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,7 +116,7 @@ The 4 coordinates, xMin, xMax, yMin, yMax are optional. If not specified, the bo
116
116
| `borderCapStyle` | Cap style of the border of polygon. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap).
117
117
| `borderDash` | Length and spacing of dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
118
118
| `borderDashOffset` | Offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
119
-
| `borderJoinStyle` | Border line joint style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
119
+
| `borderJoinStyle` | Border line join style. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin).
120
120
| `borderShadowColor` | The color of the border shadow. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowColor).
121
121
| `borderWidth` | Stroke width.
122
122
| `shadowBlur` | The amount of blur applied to shadow. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/shadowBlur).
0 commit comments