score:-1
It does not look like there's a title option in the canvas. Your best bet would likely be to bind another element in the template.
chart.component.html
<div>
<h3>{{ barChartTitle }}</h3>
<div style="display: block">
<canvas baseChart
[datasets]="barChartData"
[labels]="barChartLabels"
[options]="barChartOptions"
[legend]="barChartLegend"
[chartType]="barChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
score:0
public barChartOptions: ChartConfiguration['options'] = {
scales: {
x: { ticks: {
maxRotation: 70,
minRotation: 70,
}},
y: {
max: 20,
min: -20,
}
},
plugins: {
title: {
display: true,
text: 'Title Chart'
},
legend: {
display: true,
position: 'bottom',
},
datalabels: {
anchor: 'end',
align: 'end'
}
}
};
score:10
You can specify it as part of the chart options, e.g.
private barChartOptions = {
title: {
text: 'my title',
display: true
}
};
You can specify additional properties for font size etc, see the docs at: http://www.chartjs.org/docs/latest/configuration/title.html
Source: stackoverflow.com
Related Query
- how to add a title to my ng2-charts bar chart
- How to add second Y-axis for Bar and Line chart in Chart.js?
- How to add background image in bar chart column in Chart.js?
- How to add title inside doughnut chart in Angular Chart?
- how can i add value on bar in the charts in chart.js vs 3.x
- How to add unused data background to bar in chart js
- How to add labels on top of the chart bar with Chart.js 2
- ng2 charts bar chart need spacing between 2 bars in series Angular
- How to add custom text inside the bar and how to reduce the step size in y axis in chart js( Bar chart )
- How to add space between datasets in ng2 doughnut chart
- How to add data labels in each bar in stacked bar chart in chart.js?
- How to add label square to Bar Chart using Chart.js
- How is it possible to make curved bar chart or curved column charts in chart.js?
- How to add vertical line in bar chart using chartJs and ng2-charts?
- how to not repeat code while creating multiple charts in chart js
- How to add text inside the doughnut chart using Chart.js?
- chart js 2 how to set bar width
- How to modify bar width in Chartjs 2 bar charts
- Chart.js Bar Chart - how to chart bars from 0
- How to add an on click event to my Line chart using Chart.js
- How do you hide the title of a chart tooltip?
- How to put rounded corners on a Chart.js Bar chart
- chartjs : how to set custom scale in bar chart
- How to save Chart JS charts as image without black background using blobs and filesaver?
- Add DataSet Bar Chart - Chart.JS
- How to add images as labels to Canvas Charts using chart.js
- How to add an offset to a dataset in Chart js
- ChartJS add tooltip to a grouped bar chart
- How to add text in centre of the doughnut chart using Chart.js?
- How to create stacked bar chart using react-chartjs-2?
More Query from same tag
- Chart.js how to resend animation command to a chart?
- Some imports are missing in ng2-charts@3.0.8
- add a unit to label with chartjs plugin datalabels
- Mixed Chart calculating difference between two bars - ChartJS
- display ng2 chart when the property of data returned is >=0
- Chartjs animate x-axis displaying data incorrectly in mac device
- Chart.js dynamic bar width
- NuxtJS ChartJS Gradient Color doesnt apply
- (Laravel) How to pull data from API Controller so that it will display in vue-chartjs
- Chart in other module
- Angular 4: Different color for bar in bar chart dynamically using ChartJS
- Django and ChartJS
- Chart.js noob - Can't get anything to display
- how to put a second pie chart right next to first pie chart inside the bootstrap card
- Annotation plugin not working with Chart.js 2.8.0
- How can I cause a legend to appear to the right of the pie (Chart.JS)?
- ChartJS line chart drag and zoom
- Create multiple pie chart simultaneously using chart.js
- Get X, Y onClick chart coordinates in ChartJS
- How to change label color of ng2 chart in angular
- Multiple bar widths in Chart.js bar chart
- ChartJS - Set different hover-text than x-axis description
- Creating dropdown options with Chart.js using select tag and multiple canvas
- Display Doughnut Pie Chart As Circle Progress Chart.js
- Chart JS distance between bar stacked
- Chart js show/hide legend during runtime via buttonClick
- Border behind grid line
- Chart.js : straight lines instead of curves
- chart.js not allowing y axis steps with logarithmic scale
- syntax to loop through docs send from express router and use it to plot chart js