score:3
Thanks to @DTul, I figured it out. The title configuration is here: https://www.chartjs.org/docs/latest/configuration/title.html.
I've added the following section:
title: {
display: true,
text: 'Custom Chart Title',
position: 'bottom'
}
to the options
.
The whole example looks now like that:
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {
rotation: 1 * Math.PI,
circumference: 1 * Math.PI,
title: {
display: true,
text: 'Custom Chart Title',
position: 'bottom'
}
}
});
The corresponding fiddle is here: https://jsfiddle.net/ktq8mb0z/
score:0
half-doughnut, or how I call it, a speedometer graph, is now configured with degrees:
var chart = new Chart(canvas, {
type: 'doughnut',
data: ['400', '200'],
options: {
rotation: -90,
circumference: 180,
}
I did this in Chartjs version 3.5.1
score:1
I used this instructions
How can I add some text in the middle of a half doughnut chart in Chart.JS?
some changes for text position and fontsize
var fontSizeToUse = 16;
var centerY = ((chart.chartArea.top + chart.chartArea.bottom) - 80);
Source: stackoverflow.com
Related Query
- How can I add some text in the middle of a half doughnut chart in Chart.JS?
- How to add text inside the doughnut chart using Chart.js?
- How to add text in centre of the doughnut chart using Chart.js?
- How to add text inside the doughnut chart using Chart.js version 3.2.1
- How to add text inside the doughnut chart using Chart.js AngularJS 2.0?
- Chart.js - How to Add Text in the Middle of the Chart?
- Vue Chart 3 - Doughnut Charts with Text in the Middle (Trouble registering a plugin)
- How to rotate the Label text in doughnut chart slice vertically in chart.js canvas, Angular 12?
- Styling the middle text of Chart.js's doughnut chart
- How to add image inside the doughnut chart using chart.js?
- 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 see labels without losing middle text in doughnut chart
- How can I add functionality to Chartjs Doughnut chart custom legend
- Chart.js - How to Add Text in the label of the Chart with JavaScript?
- Chart js. How to align text by the center of the tooltip?
- How can I remove extra whitespace from the bottom of a line chart in chart.js?
- How to display the labels in doughnut chart using ng2 charts?
- Chart js: how can I align the legend and the title
- How can I display the xAxes and yAxes data in the tooltip, Chart JS?
- How can I trigger the hover mode from outside the chart with charts.js 2?
- How to draw a needle on a custom donut chart and add datapoints to the needle?
- How to add title inside doughnut chart in Angular Chart?
- Add Text to Doughnut Chart - ChartJS
- CHART.JS How can I offset/move/adjust the labels on the y-axis to be in the middle of the gridlines instead of centered on the gridlines?
- Chart is too big. How can I reduce size for the chart in vue js?
- How to add labels for only some of the data point?
- How can I add a unit to the end of my Y Axis values in ChartJS?
- angular-chart.js doughnut chart : How do I change width of the arc of a doughnut?
- How can I have different values for the chart and the tooltip in chart.js?
- How can I add a euro sign (€) to all tooltips in my chart js line chart
More Query from same tag
- Adding a Date adapter for Time Cartesian axis from a cdn
- Add different labels in a line chart - Chart.js
- pie chart not rendered properly in flask app
- Checkboxes unchecked after cart.js end of update animation
- How to make ng2-Chart Scrollable for large amount of data sets?
- is there a way to do automatic scrolling?
- Pass List of Objects as data
- Chart js - Get bar width after render
- ChartJS: Show all tooltips with Total for Multi Pie chart
- how to align count text center in horizontal bar in the Chart.js?
- How to add label in chart.js for polar chart area
- Chart.js t.ticks.map is not a function
- MYSQL Query and Chart.js and PHP
- How to center radar chart ticks when changing start angle of chart?
- Fit all content inside a HTML page designed using bootstrap in the viewable area without need to scroll
- How to use Utils from Chartjs on Django
- How to Import Angular Chart in IONIC
- ChartJS with React: Only one value showing on time chart
- how to highlight the bars in stacked bar chart of chart.js on clicking a legend
- Line graph in Angular 7 not working - is data type proper?
- Loading Laravel Chart consoletvs/charts:7.*
- Chart.js - Responsiveness not correctly working on device orientation change
- How to draw Horizontal line on Bar Chart Chartjs
- How to set subscript text in Chart.js axis title
- I am having this error in charts v3 chartjs-chart-treemap: fontColor does not exist in type 'ChartDataset<"treemap", TreemapDataPoint[]>
- How do I use this new extension for chart.js?
- How to unit test statement 'chart.chart.update()' in jasmine?
- How can I build some chart with Chart.js and ng2-charts using an array of revenus & budgets per month date as Data source?
- How to sort stacked bar chart on certain value of bar in charts.js
- Convert date label on Y-axis Line Chart to specific date format