Layout Configuration

The layout configuration is passed into the options.layout namespace. The global options for the chart layout is defined in Chart.defaults.global.layout.

NameTypeDefaultDescription
paddingnumber|object0The padding to add inside the chart. more…

Padding

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.

Lets say you wanted to add 50px of padding to the left side of the chart canvas, you would do:

  1. let chart = new Chart(ctx, {
  2. type: 'line',
  3. data: data,
  4. options: {
  5. layout: {
  6. padding: {
  7. left: 50,
  8. right: 0,
  9. top: 0,
  10. bottom: 0
  11. }
  12. }
  13. }
  14. });