Skip to content

Commit 718f460

Browse files
docs: notes about html legend, tooltip and title (#10857)
* docs: notes about html legend, tooltip and title * Update docs/configuration/legend.md Co-authored-by: Jacco van den Berg <[email protected]> * Update docs/configuration/tooltip.md Co-authored-by: Jacco van den Berg <[email protected]> * docs: notes about html legend, tooltip and title fix Co-authored-by: Jacco van den Berg <[email protected]>
1 parent 5a90b71 commit 718f460

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

docs/configuration/legend.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ The doughnut, pie, and polar area charts override the legend defaults. To change
2727
| `textDirection` | `string` | canvas' default | This will force the text direction `'rtl'` or `'ltr'` on the canvas for rendering the legend, regardless of the css specified on the canvas
2828
| `title` | `object` | | See the [Legend Title Configuration](#legend-title-configuration) section below.
2929

30+
:::tip Note
31+
If you need more visual customizations, please use an [HTML legend](../samples/legend/html.md).
32+
:::
33+
3034
## Position
3135

3236
Position of the legend. Options are:
@@ -62,7 +66,7 @@ Namespace: `options.plugins.legend.labels`
6266
| `padding` | `number` | `10` | Padding between rows of colored boxes.
6367
| `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.
6468
| `filter` | `function` | `null` | Filters legend items out of the legend. Receives 2 parameters, a [Legend Item](#legend-item-interface) and the chart data.
65-
| `sort` | `function` | `null` | Sorts legend items. Type is : `sort(a: LegendItem, b: LegendItem, data: ChartData): number;`. Receives 3 parameters, two [Legend Items](#legend-item-interface) and the chart data. The return value of the function is a number that indicates the order of the two legend item parameters. The ordering matches the [return value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description) of `Array.prototype.sort()`
69+
| `sort` | `function` | `null` | Sorts legend items. Type is : `sort(a: LegendItem, b: LegendItem, data: ChartData): number;`. Receives 3 parameters, two [Legend Items](#legend-item-interface) and the chart data. The return value of the function is a number that indicates the order of the two legend item parameters. The ordering matches the [return value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description) of `Array.prototype.sort()`
6670
| [`pointStyle`](elements.md#point-styles) | [`pointStyle`](elements.md#types) | `'circle'` | If specified, this style of point is used for the legend. Only used if `usePointStyle` is true.
6771
| `textAlign` | `string` | `'center'` | Horizontal alignment of the label text. Options are: `'left'`, `'right'` or `'center'`.
6872
| `usePointStyle` | `boolean` | `false` | Label style will match corresponding point style (size is based on pointStyleWidth or the minimum value between boxWidth and font.size).

docs/configuration/title.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Namespace: `options.plugins.title`, the global options for the chart title is de
1717
| `padding` | [`Padding`](../general/padding.md) | `10` | Yes | Padding to apply around the title. Only `top` and `bottom` are implemented.
1818
| `text` | `string`\|`string[]` | `''` | Yes | Title text to display. If specified as an array, text is rendered on multiple lines.
1919

20+
:::tip Note
21+
If you need more visual customizations, you can implement the title with HTML and CSS.
22+
:::
23+
2024
### Position
2125

2226
Possible title position values are:

docs/configuration/tooltip.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ The bubble, doughnut, pie, polar area, and scatter charts override the tooltip d
5050
| `xAlign` | `string` | `undefined` | Position of the tooltip caret in the X direction. [more](#tooltip-alignment)
5151
| `yAlign` | `string` | `undefined` | Position of the tooltip caret in the Y direction. [more](#tooltip-alignment)
5252

53+
:::tip Note
54+
If you need more visual customizations, please use an [HTML tooltip](../samples/tooltip/html.md).
55+
:::
56+
5357
### Position Modes
5458

5559
Possible modes are:

0 commit comments

Comments
 (0)