| commit | author | age | ||
| 83c3f6 | 1 | # Title |
| SP | 2 | |
| 3 | The chart title defines text to draw at the top of the chart. | |
| 4 | ||
| 5 | ## Title Configuration | |
| 6 | The title configuration is passed into the `options.title` namespace. The global options for the chart title is defined in `Chart.defaults.global.title`. | |
| 7 | ||
| 8 | | Name | Type | Default | Description | |
| 9 | | -----| ---- | --------| ----------- | |
| 10 | | `display` | `Boolean` | `false` | is the title shown | |
| 11 | | `position` | `String` | `'top'` | Position of title. [more...](#position) | |
| 12 | | `fontSize` | `Number` | `12` | Font size | |
| 13 | | `fontFamily` | `String` | `"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"` | Font family for the title text. | |
| 14 | | `fontColor` | `Color` | `'#666'` | Font color | |
| 15 | | `fontStyle` | `String` | `'bold'` | Font style | |
| 16 | | `padding` | `Number` | `10` | Number of pixels to add above and below the title text. | |
| 17 | | `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)) | |
| 18 | | `text` | `String/String[]` | `''` | Title text to display. If specified as an array, text is rendered on multiple lines. | |
| 19 | ||
| 20 | ### Position | |
| 21 | Possible title position values are: | |
| 22 | * `'top'` | |
| 23 | * `'left'` | |
| 24 | * `'bottom'` | |
| 25 | * `'right'` | |
| 26 | ||
| 27 | ## Example Usage | |
| 28 | ||
| 29 | The example below would enable a title of 'Custom Chart Title' on the chart that is created. | |
| 30 | ||
| 31 | ```javascript | |
| 32 | var chart = new Chart(ctx, { | |
| 33 | type: 'line', | |
| 34 | data: data, | |
| 35 | options: { | |
| 36 | title: { | |
| 37 | display: true, | |
| 38 | text: 'Custom Chart Title' | |
| 39 | } | |
| 40 | } | |
| 41 | }) | |
| 42 | ``` | |