score:2
There is a plugin for what you want to do: https://github.com/ciprianciurea/chartjs-plugin-doughnutlabel
score:1
I actually ended up doing this:
<div style="position: relative;" data-bind="dxPieChart: {
//chart initialization code from above...
}">
<div style="position: absolute; top: 50%; margin-top: -15px; left: 50%; font-size: 30px; line-height: 30px; margin-left: -50px; width: 100px; text-align: center;" data-bind="text: alarmIDs().length"></div>
<div style="position: absolute; top: 50%; margin-top: 15px; left: 50%; font-size: 15px; line-height: 15px; margin-left: -50px; width: 100px; text-align: center;">alarms</div>
</div>
When it binds the chart it doesn't overwrite any internal HTML, so this works brilliantly.
score:3
As a workaround until the open issue is complete, you could just draw your own total on the canvas element itself.
You will have to manually calculate the x/y position on the canvas (like [150,100] in this example).
var canvas=document.getElementById("myChart");
var ctx=canvas.getContext("2d");
ctx.font="36px verdana";
ctx.fillText("76",150,100);
Source: stackoverflow.com
Related Query
- Put sum of values in center of doughnut chart?
- Adding a label to a doughnut chart in Chart.js shows all values in each chart
- Force ChartJS to show Doughnut chart with null values
- Chart.js - Pie chart calculate sum of visible values after legend click
- ChartJS : Hook before values are given to doughnut (absolute value in chart and real values in the tooltips)
- Put the value into the doughnut chart
- Chart.js How to sum the values in a pie chart and display them in the header
- angular-chart.js doughnut chart : how to show data in the center of a chart
- getting additional value fields from data source for dx.chartjs doughnut chart
- Change the Center color of doughnut chart in Chart.Js
- Dynamically update values of a chartjs chart
- How to add text inside the doughnut chart using Chart.js?
- line chart with {x, y} point data displays only 2 values
- How get sum of total values in stackedBar ChartJs
- How to put rounded corners on a Chart.js Bar chart
- Chart.js doughnut chart tooltip size?
- How to add text in centre of the doughnut chart using Chart.js?
- Chart.js v2.6: Add arrows to pie chart output values
- Display values outside of pie chart in chartjs
- Can't resize react-chartjs-2 doughnut chart
- How to display inline values in a stacked bar chart with Chart.js?
- Chart.js Timeseries chart - formatting and missing data values
- Chart js. How to align text by the center of the tooltip?
- Display Doughnut Pie Chart As Circle Progress Chart.js
- Chart js x-axis values getting repeated twice
- Center point labels between ticks (Polar Area Chart JS)
- How to align Chart.JS line chart labels to the center
- Chart.JS full-width, responsive doughnut chart with Bootstrap
- How to display the labels in doughnut chart using ng2 charts?
- Chart.js HTML custom legend issues with doughnut chart
More Query from same tag
- How to properly feed data to ChartJS with different number of x(labels) and y(data) points
- Charts.js & Bootstrap Accordion
- Convert charts from vue-chartjs to a PDF
- Chart.js line chart tooltip shows wrong label when line doesn't start at first label
- Plotting jqplot points to a chart.js chart
- How to set start value as “0” in Chart.js Laravel
- Chart.js not to be begin in Y-Axis
- Chartjs treemap example
- How to make integer scale in Chartjs
- Dotted Line in ChartJS
- ChartJS Unix Time Values changed
- (Angular Ionic) How can I stream my custom data with chartjs-plugin-streaming?
- Line chart using Chart.js
- Error when changing data after migrating to vue-chartjs 4
- hiding x-axes labels with 0 values on a bar chart
- react-chartjs-2 Line Chart not updating with State
- How to create overlapping bar charts in angular js?
- Can't pass data to chart.js graph
- Unable to display chartjs chart in Shiny UI
- Vue3 Chart.js not rendering
- How to set different colors in each stacked bar chart cell?
- Getting the postion of the y-axis labels in chartJS
- Dynamic rendering of chart with chartjs
- Truncating canvas labels in ChartJS while keeping the full label value in the tooltips
- Is it possible to get the assigned ref name in a component? Vue.js
- OffsetWidth / offsetHeight is zero when template loaded by ngRoute
- ChartJS Radar Chart radar lines color?
- react chart js skip zero value month
- Chart.js - add gradient instead of solid color - implementing solution
- Are you able to offset a secondary y-axis in ChartJS, by a decimal value, whilst keeping the same scale for both y-axes?