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
- Chart.js animation triggered only on hover?
- Loop through array of objects in Node
- How do we can use chart.js in angular JS?
- DiscordAPIError: Invalid Form Body embed.image.url: Scheme "[object response]" is not supported. Scheme must be one of ('http', 'https')
- Angular and ChartJS to create bar chart
- Execute onClick function on Custom Legend
- Is it possible to set up 0 as a minimum number for bar chart? react-chart.js-2
- ChartJs - pie chart not showing
- How to group smaller Pie Chart slices together to Improve Readability in chartjs
- Is there a way to trigger point hit on an xAxis hover
- How to ensure that a Chart.js line chart uses all space available on the y-axis?
- How we can draw a circle in bar chart
- Chartjs change the specific label color in x axis in callback function
- cannot read property 'yyyx' of undefined
- In react hooks, how can i pass the filtered values to the chart?
- The title of my ChartJs on the chart is undefined, but I can't change it because my labels use a function: Object.keys(groupMedia)
- how to use chartJS to show breakdown of selected data
- Chart.js Increase font size for higher resolution (i.e. monitor-agnostic chart configuration )
- Chart.js scale x values
- charts.js Stacked Bar Graphs - selecting row and dataset selected
- How to make bar chart animation where all bars grow at the same speed?
- Chart.js display x axis labels ON ticks in bar chart, not between
- Chart JS not showing all data
- AngularJS Pagination not showing all pages
- Chart js scatter - display label on hover
- Chart in other module
- How to make interactive a chart with chart.js
- Chart.js show negative value in the top half
- How to put static pointDots and make vertical line in Chart.js
- Chart.js the point's limit supported