mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
ed2b96eeaf
* Initial work * Update doc commands * Updated sidebar config * Move docs * Update theme version and enable * Convert to chart.js sample * Update scripts to point to local build * Chart.js from local build * Simplify getting-started example * Axis docs updated except for imported content * Common ticks import works * Chart type docs ported to editor plugin * Last pages to use editor * Fix small errors * Frontmatter title to heading * Remove duplicate example * Update sidebar * Add paths * Remove paths * Add getting-started back * Update menus and add copyright to license section of the docs * Add GA plugin * Style sub-groups * Remove unneeded license page since it is covered on the main page * Remove docusaurus readme page * Remove docusaurus files * Fix issues in docs * Build and deploy scripts for docs work * Conditional base URL for nice local testing * Use eslint-plugin-markdown * Remove hard coded lines * Remove mentions of docusaurus Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
2.0 KiB
2.0 KiB
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
.
Name | Type | Default | Description |
---|---|---|---|
align |
string |
'center' |
Alignment of the title. more... |
color |
Color |
Chart.defaults.color |
Color of text. |
display |
boolean |
false |
Is the title shown? |
fullSize |
boolean |
true |
Marks 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. |
position |
string |
'top' |
Position of title. more... |
font |
Font |
{style: 'bold'} |
See Fonts |
padding |
Padding |
10 |
Padding to apply around the title. Only top and bottom are implemented. |
text |
string |string[] |
'' |
Title 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.
var chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
plugins: {
title: {
display: true,
text: 'Custom Chart Title'
}
}
}
});
This example shows how to specify separate top and bottom title text padding:
var chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
plugins: {
title: {
display: true,
text: 'Custom Chart Title',
padding: {
top: 10,
bottom: 30
}
}
}
}
});