]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Adds HTMLCanvasElement as possible value for pointStyle option (#9458)
authorstockiNail <stocki.nail@gmail.com>
Fri, 23 Jul 2021 05:26:49 +0000 (07:26 +0200)
committerGitHub <noreply@github.com>
Fri, 23 Jul 2021 05:26:49 +0000 (08:26 +0300)
docs/charts/bar.md
docs/charts/bubble.md
docs/charts/line.md
docs/charts/radar.md
docs/configuration/elements.md
docs/configuration/legend.md

index 00358e849e22fc07d815085de2746cf815a515d6..f7182b10ee9ae1b7103f957827d692676d3e99cc 100644 (file)
@@ -90,7 +90,7 @@ Only the `data` option needs to be specified in the dataset namespace.
 | [`minBarLength`](#styling) | `number` | - | - | |
 | [`label`](#general) | `string` | - | - | `''`
 | [`order`](#general) | `number` | - | - | `0`
-| [`pointStyle`](../configuration/elements.md#point-styles) | `string`\|`Image` | Yes | - | `'circle'`
+| [`pointStyle`](../configuration/elements.md#point-styles) | `string`\|`Image`\|`HTMLCanvasElement` | Yes | - | `'circle'`
 | [`skipNull`](#general) | `boolean` | - | - | |
 | [`stack`](#general) | `string` | - | - | `'bar'` |
 | [`xAxisID`](#general) | `string` | - | - | first x axis
index 94fb7ebb9ba464482c23e596c5d91ed729d6286a..4f4071296831fdbd1b446c29136caab820d5bd63 100644 (file)
@@ -60,7 +60,7 @@ The bubble chart allows a number of properties to be specified for each dataset.
 | [`hitRadius`](#interactions) | `number` | Yes | Yes | `1`
 | [`label`](#general) | `string` | - | - | `undefined`
 | [`order`](#general) | `number` | - | - | `0`
-| [`pointStyle`](#styling) | `string`\|`Image` | Yes | Yes | `'circle'`
+| [`pointStyle`](#styling) | `string`\|`Image`\|`HTMLCanvasElement` | Yes | Yes | `'circle'`
 | [`rotation`](#styling) | `number` | Yes | Yes | `0`
 | [`radius`](#styling) | `number` | Yes | Yes | `3`
 
index d872dd9d6b1471948089213186402e16a921eb33..ff926a50495d15456e20f28464d4c3e7cfb97b78 100644 (file)
@@ -75,7 +75,7 @@ The line chart allows a number of properties to be specified for each dataset. T
 | [`pointHoverRadius`](#interactions) | `number` | Yes | Yes | `4`
 | [`pointRadius`](#point-styling) | `number` | Yes | Yes | `3`
 | [`pointRotation`](#point-styling) | `number` | Yes | Yes | `0`
-| [`pointStyle`](#point-styling) | `string`\|`Image` | Yes | Yes | `'circle'`
+| [`pointStyle`](#point-styling) | `string`\|`Image`\|`HTMLCanvasElement` | Yes | Yes | `'circle'`
 | [`segment`](#segment) | `object` | - | - | `undefined`
 | [`showLine`](#line-styling) | `boolean` | - | - | `true`
 | [`spanGaps`](#line-styling) | `boolean`\|`number` | - | - | `undefined`
index fad17934c90e6f6ffefd9a88d9e88d9d4b263cb1..fb425c56ef825456ae25406e63f671d47cd13933 100644 (file)
@@ -104,7 +104,7 @@ The radar chart allows a number of properties to be specified for each dataset.
 | [`pointHoverRadius`](#interactions) | `number` | Yes | Yes | `4`
 | [`pointRadius`](#point-styling) | `number` | Yes | Yes | `3`
 | [`pointRotation`](#point-styling) | `number` | Yes | Yes | `0`
-| [`pointStyle`](#point-styling) | `string`\|`Image` | Yes | Yes | `'circle'`
+| [`pointStyle`](#point-styling) | `string`\|`Image`\|`HTMLCanvasElement` | Yes | Yes | `'circle'`
 | [`spanGaps`](#line-styling) | `boolean` | - | - | `undefined`
 
 All these values, if `undefined`, fallback to the scopes described in [option resolution](../general/options)
index a8ec4f1789d5f56d1053ddec45e6b6af1be554de..af39cdb3d79fad08dc5558230952df70622e7465 100644 (file)
@@ -19,7 +19,7 @@ Namespace: `options.elements.point`, global point options: `Chart.defaults.eleme
 | Name | Type | Default | Description
 | ---- | ---- | ------- | -----------
 | `radius` | `number` | `3` | Point radius.
-| [`pointStyle`](#point-styles) | `string`\|`Image` | `'circle'` | Point style.
+| [`pointStyle`](#point-styles) | `string`\|`Image`\|`HTMLCanvasElement` | `'circle'` | Point style.
 | `rotation` | `number` | `0` | Point rotation (in degrees).
 | `backgroundColor` | [`Color`](../general/colors.md) | `Chart.defaults.backgroundColor` | Point fill color.
 | `borderWidth` | `number` | `1` | Point stroke width.
@@ -43,7 +43,7 @@ The following values are supported:
 - `'star'`
 - `'triangle'`
 
-If the value is an image, that image is drawn on the canvas using [drawImage](https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/drawImage).
+If the value is an image or a canvas element, that image or canvas element is drawn on the canvas using [drawImage](https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/drawImage).
 
 ## Line Configuration
 
@@ -79,7 +79,7 @@ Namespace: `options.elements.bar`, global bar options: `Chart.defaults.elements.
 | `borderColor` | [`Color`](/general/colors.md) | `Chart.defaults.borderColor` | Bar stroke color.
 | `borderSkipped` | `string` | `'start'` | Skipped (excluded) border: `'start'`, `'end'`, `'middle'`, `'bottom'`, `'left'`, `'top'`, `'right'` or `false`.
 | `borderRadius` | `number`\|`object` | `0` | The bar border radius (in pixels).
-| [`pointStyle`](#point-styles) | `string`\|`Image` | `'circle'` | Style of the point for legend.
+| [`pointStyle`](#point-styles) | `string`\|`Image`\|`HTMLCanvasElement` | `'circle'` | Style of the point for legend.
 
 ## Arc Configuration
 
index 9f8040c0be5706b066edb722f6a8a7852acc62d7..77aa9e0ab674f4903d8805429485a1a95f7cc999 100644 (file)
@@ -59,7 +59,7 @@ Namespace: `options.plugins.legend.labels`
 | `generateLabels` | `function` | | Generates legend items for each thing in the legend. Default implementation returns the text + styling for the color box. See [Legend Item](#legend-item-interface) for details.
 | `filter` | `function` | `null` | Filters legend items out of the legend. Receives 2 parameters, a [Legend Item](#legend-item-interface) and the chart data.
 | `sort` | `function` | `null` | Sorts legend items. Receives 3 parameters, two [Legend Items](#legend-item-interface) and the chart data.
-| [`pointStyle`](elements.md#point-styles) | `string`\|`Image` | `'circle'` | If specified, this style of point is used for the legend. Only used if `usePointStyle` is true.
+| [`pointStyle`](elements.md#point-styles) | `string`\|`Image`\|`HTMLCanvasElement` | `'circle'` | If specified, this style of point is used for the legend. Only used if `usePointStyle` is true.
 | `textAlign` | `string` | `'center'` | Horizontal alignment of the label text. Options are: `'left'`, `'right'` or `'center'`.
 | `usePointStyle` | `boolean` | `false` | Label style will match corresponding point style (size is based on the minimum value between boxWidth and font.size).
 
@@ -119,7 +119,7 @@ Items passed to the legend `onClick` function are the ones returned from `labels
     strokeStyle: Color,
 
     // Point style of the legend box (only used if usePointStyle is true)
-    pointStyle: string | Image,
+    pointStyle: string | Image | HTMLCanvasElement,
 
     // Rotation of the point in degrees (only used if usePointStyle is true)
     rotation: number