score:1
Accepted answer
you can convert the values to percentage and then format the data with %
and pass it to the chart. or you can use plugin like this, example
var options = {
tooltips: {
enabled: false
},
plugins: {
datalabels: {
formatter: (value, ctx) => {
let sum = 0;
let dataarr = ctx.chart.data.datasets[0].data;
dataarr.map(data => {
sum += data;
});
let percentage = (value*100 / sum).tofixed(2)+"%";
return percentage;
},
color: '#fff',
}
}
};
refer show percentile values in doughnutchart . happy coding!!
Source: stackoverflow.com
Related Query
- How to customize percentage label in Doughnutchart ng2 chart.js
- How to change label color of ng2 chart in angular
- How to show percentage (%) in chart js
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- How to display the labels in doughnut chart using ng2 charts?
- PrimeNg bar chart how to show a label for the y-axis
- How to add label in chart.js for polar chart area
- How to show percentage (%) using chartjs-plugin-labels ( Pie chart ) in angular 2/8
- ChartJS version 3 how to add percentage to pie chart tooltip
- how to customize tool tip while mouse go over bars on Chart js bar chart
- How to change the label and grid line position on a timeseries chart in Chart.js 3?
- How to customize chart js Bar chart shape?
- How do I customize y-axis labels and randomly pick the value from the data range for x-axis in Chart js
- how to add percentage value to legend field in pie chart using chart.js
- how to label axis within radar chart with chart.js
- How to stop axis label from being cut off in chart JS?
- How to change default label of each bubble in bubble chart using chartjs-plugin-datalabels
- How to rotate the Label text in doughnut chart slice vertically in chart.js canvas, Angular 12?
- Chart JS, ng2-Charts - How to make the label to the right of pie chart instead on top?
- Chart.js how to remove final label on chart
- How to introduce newline character in xAxes Label with chart js
- How to increase space between label and chart area in chart.js
- How to scale label size radar chart chart.js
- How to customize tooltip on mouse hover of a polar area chart of Angular Charts
- How do I get a different label for each bar in a bar chart in ChartJS?
- How can I avoid NaN on pie chart label in Chart JS
- How to get line x value from Label chart js
- How to remove a label in top of bar in chartjs chart
- How to print a chart rendered by code
- Chart Piechart in only show percentage on hover but it shows data and label with percentage both i just want to show percentage only percentage
More Query from same tag
- Angular chartjs directive
- How to access custom property in dataset object in Bar Chart in React ChartJS 2?
- How to add images as labels to Canvas Charts using chart.js
- How to make a prefilled doughnut in chart.js?
- Angular 2 & ng2-charts: (SystemJS) Unexpected directive 'BaseChartComponent' imported
- Reload chart on api call
- Chart.js updating data
- How to group and count missing values using linq
- Limit labesl on chart.js bar chart
- Chart.js Console JS Error while destroy the Chart on click event
- ChartJS incorrect plot when plotting multiple line charts in one graph
- Canvas is already in use. Chart with ID '0' must be destroyed before the canvas can be reused. chat.JS
- Group bar chart in ReactChartJS2 click particular element
- chartjs-plugin-zoom not working on offline environment javascript .js
- How to loop inside javascript using php variable
- How to get chartjs column chart in ng-repeat
- How can I create a long tail chart with chart.js
- ChartJS not rendering after update
- CSS/JSX: Fixing two HTML canvas within a div with relative width as 60% and 40%
- Pie chart inside doughnut on same canvas
- Formatting x-axis labels as time values in Chart.js
- "Cannot read propery "defaults" of undefined" error while using react-chartjs-2
- Can you change legend style for bar datasets with chart.js?
- Add horizontal Line to my chart.js Barchart
- Change label color Y and X axis chart.js
- Adding a Date adapter for Time Cartesian axis from a cdn
- Chart.js Currency Tooltip
- How can I display different values on xAxes than on tooltip Chart.js V3
- Why is this bar chart using chart.js not rendering in react.js?
- Change Axis Line color in Chart created using chart.js