| commit | author | age | ||
| 83c3f6 | 1 | # Layout Configuration |
| SP | 2 | |
| 3 | The layout configuration is passed into the `options.layout` namespace. The global options for the chart layout is defined in `Chart.defaults.global.layout`. | |
| 4 | ||
| 5 | | Name | Type | Default | Description | |
| 6 | | -----| ---- | --------| ----------- | |
| 7 | | `padding` | `Number` or `Object` | `0` | The padding to add inside the chart. [more...](#padding) | |
| 8 | ||
| 9 | ## Padding | |
| 10 | If this value is a number, it is applied to all sides of the chart (left, top, right, bottom). If this value is an object, the `left` property defines the left padding. Similarly the `right`, `top`, and `bottom` properties can also be specified. | |
| 11 | ||
| 12 | Lets say you wanted to add 50px of padding to the left side of the chart canvas, you would do: | |
| 13 | ||
| 14 | ```javascript | |
| 15 | let chart = new Chart(ctx, { | |
| 16 | type: 'line', | |
| 17 | data: data, | |
| 18 | options: { | |
| 19 | layout: { | |
| 20 | padding: { | |
| 21 | left: 50, | |
| 22 | right: 0, | |
| 23 | top: 0, | |
| 24 | bottom: 0 | |
| 25 | } | |
| 26 | } | |
| 27 | } | |
| 28 | }); | |
| 29 | ``` | |