Title Configuration Options

There are some of the options are mentioned below:

  • align: This option allows you to align the text in “start”, “center” or “end”. It is of String type & the default value is center.
  • color: This option is used to set the color of the text. It is of Color type & the default value is Chart.defaults.color.
  • display: This is used to control the visibility of the title on screen. It is of Boolean type & default value is false.
  • fullSize: It helps to define the full width/height of the canvas box. It is of Boolean type & default value is true.
  • position: It helps to define the position for the title of the Chart. It is of String type & the default value is top.
  • font: It is used to set the font for the Chart. It is of Font type & the default value is bold.
  • padding: It is used to implement the padding around the title, where only the top & bottom can be implemented. It is of padding type & the default value is 10.
  • text: This is the actual text which will be displayed as a title on the screen. It is of string|string[] type & the default value is ‘ ‘.

Chart.js Title Configuration

In this article, we will learn the concept of Chart.Js Title Configuration by using the Chart.js CDN library, along with understanding their basic implementation through the illustrations.

In Chart.js, Title Configuration is mainly the config option to customize and manage the title of the chart. There are different types of configurations that are embedded here. The options.plugins.title is the global option that defines the chat title in Chart.defaults.plugins.title.

Similar Reads

Title Configuration Options

There are some of the options are mentioned below:...

Approach

In the HTML design, use the HTML tag to mainly show the graph. In this script part of the code, firstly we need to initialize the object of the ChartJS by setting different properties like type, label, data, and other options. In the options property, we have aligned the configuration. So we need to define different properties for this title configuration like display, text, align, color, fullSize, position, etc....

CDN link

...

Syntax

options: { plugins: { title: { display: true, text: 'Title Text', align: 'center', color: 'black', fullSize: true, position: 'top', font: { size: 16, weight: 'normal', family: 'Arial', style: 'normal' }, padding: { top: 10, bottom: 10, left: 10, right: 10 } } } }...