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 is only displaying after f12 is pressed
- How to Draw Gantt chart using chart js or other libraries
- Chart.js dynamic updates with data from database
- How to decrease bottom width of triangle using line chart in chartJs?
- Combine Chart.js programmatic and legend based dataset toggling
- How to make the background color of the chart as gradient using Chart.js
- How to get rid of old data and of old graph in Chart.js?
- js devexpress PieChart Series color runtime
- How can I specify "per dataset" parsing with Chart.js?
- Chartjs 2 scaling lots of data points
- Problem in passing values using props in react.js while using chart.js
- chart.js aspect ratio not square
- How to add tooltips to chart.js graph
- implement chartjs zoom with buttons
- chart.js 2 - Is it possible to format tick labels with HTML?
- Chartjs Datasets overlapping and z-index
- Reanimate Data Values in CharJS
- Chart.js not showing line chart. What am I doing wrong?
- How can I force the ".0" portion of a value to explicitly display (Chart.JS)?
- Chart.js t.ticks.map is not a function
- Pass data from array to function vue
- charts.js: how to get the legend colors of the labels
- yAxis control for stacked bar chart
- How do I force Chart.js axes min and max with react-chartjs-2?
- Show multiple data in a single data in chart.js
- How to to change mouse cursor on chart.js doughnut graph?
- ChartJS update chart with multiple datasets
- Call chartjs in rhino using java
- Chart.js I want to fix my xAxis to my yAxis position 0
- Chartjs: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'HALF_PI')