From 52aa513ebb859a33c98054179d5230b4815d8fec Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 21 Jul 2025 23:35:11 +0200 Subject: [PATCH] Mon 21 Jul 22:43:21 CEST 2025 --- js/ui/chart/docs/configuration/title.md | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 js/ui/chart/docs/configuration/title.md diff --git a/js/ui/chart/docs/configuration/title.md b/js/ui/chart/docs/configuration/title.md new file mode 100644 index 0000000..f703379 --- /dev/null +++ b/js/ui/chart/docs/configuration/title.md @@ -0,0 +1,42 @@ +# Title + +The chart title defines text to draw at the top of the chart. + +## Title Configuration +The title configuration is passed into the `options.title` namespace. The global options for the chart title is defined in `Chart.defaults.global.title`. + +| Name | Type | Default | Description +| ---- | ---- | ------- | ----------- +| `display` | `boolean` | `false` | Is the title shown? +| `position` | `string` | `'top'` | Position of title. [more...](#position) +| `fontSize` | `number` | `12` | Font size. +| `fontFamily` | `string` | `"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"` | Font family for the title text. +| `fontColor` | `Color` | `'#666'` | Font color. +| `fontStyle` | `string` | `'bold'` | Font style. +| `padding` | `number` | `10` | Number of pixels to add above and below the title text. +| `lineHeight` | number|string | `1.2` | Height of an individual line of text. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height). +| `text` | string|string[] | `''` | Title text to display. If specified as an array, text is rendered on multiple lines. + +### Position +Possible title position values are: +* `'top'` +* `'left'` +* `'bottom'` +* `'right'` + +## Example Usage + +The example below would enable a title of 'Custom Chart Title' on the chart that is created. + +```javascript +var chart = new Chart(ctx, { + type: 'line', + data: data, + options: { + title: { + display: true, + text: 'Custom Chart Title' + } + } +}); +```