Title

The chart title defines text to draw at the top of the chart.

Title Configuration

Namespace: options.plugins.title, the global options for the chart title is defined in Chart.defaults.plugins.title.

NameTypeDefaultScriptableDescription
alignstring‘center’YesAlignment of the title. more…
colorColorChart.defaults.colorYesColor of text.
displaybooleanfalseYesIs the title shown?
fullSizebooleantrueYesMarks that this box should take the full width/height of the canvas. If false, the box is sized and placed above/beside the chart area.
positionstring‘top’YesPosition of title. more…
fontFont{style: ‘bold’}YesSee Fonts
paddingPadding10YesPadding to apply around the title. Only top and bottom are implemented.
textstring|string[]‘’YesTitle text to display. If specified as an array, text is rendered on multiple lines.

Position

Possible title position values are:

  • 'top'
  • 'left'
  • 'bottom'
  • 'right'

Align

Alignment of the title. Options are:

  • 'start'
  • 'center'
  • 'end'

Example Usage

The example below would enable a title of ‘Custom Chart Title’ on the chart that is created.

  1. var chart = new Chart(ctx, {
  2. type: 'line',
  3. data: data,
  4. options: {
  5. plugins: {
  6. title: {
  7. display: true,
  8. text: 'Custom Chart Title'
  9. }
  10. }
  11. }
  12. });

This example shows how to specify separate top and bottom title text padding:

  1. var chart = new Chart(ctx, {
  2. type: 'line',
  3. data: data,
  4. options: {
  5. plugins: {
  6. title: {
  7. display: true,
  8. text: 'Custom Chart Title',
  9. padding: {
  10. top: 10,
  11. bottom: 30
  12. }
  13. }
  14. }
  15. }
  16. });