score:7
Accepted answer
You can use the following code to draw/add total count in your stacked horizontal bar chart :
this.data.datasets[0].data.forEach(function(data, index) {
var total = data + this.data.datasets[1].data[index];
var meta = chartInstance.controller.getDatasetMeta(1);
var posX = meta.data[index]._model.x;
var posY = meta.data[index]._model.y;
ctx.fillStyle = 'black';
ctx.fillText(total, posX + 4, posY + 4);
}, this);
add this inside chart's animation onComplete function.
Source: stackoverflow.com
Related Query
- Stacked horizontal bar chart along total count with chart.js
- Horizontal stacked bar chart with chart.js
- How do I create a stacked horizontal bar chart with Chart.js in React?
- Draw stacked horizontal bar chart with Average line using ChartJS
- Vertical stacked bar chart with chart.js
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- How do I draw a vertical line on a horizontal bar chart with ChartJS?
- How to display inline values in a stacked bar chart with Chart.js?
- Showing Percentage and Total In stacked Bar Chart of chart.js
- Chart.js: Minimum value for x-axis at horizontal stacked bar chart
- In Stacked horizontal bar chart how to remove the vertical line in Chart.js?
- Horizontal Stacked Bar with Gaps
- Stacked bar chart with rounded corner of bar using Chart.js
- Horizontal bar with two yaxes chart js
- ChartJS: how to make a bar chart with a horizontal guideline:
- Chartjs 3.x - How to duplicate X axis on both sides of horizontal bar chart with only 1 dataset?
- Stacked Mixed Horizontal Bar Chart in Charts.Js Axes Positioning
- Chart.Js how to hide datapoints with "0" value in Stacked Bar Chart
- Chart.js - Horizontal line on Bar chart interferes with tooltip
- Create stacked bar chart with a single dataset per stack
- Stacked bar chart with chartjs with included values
- Unable to create Stacked Grouped Bar Chart with chart.js / react-chartjs-2 in React
- ChartJS - Horizontal Stacked Bar Chart Tooltip being cut off by Bottom of Canvas
- How can I create a stacked bar chart with Charts.JS that displays relative rather than absolute values?
- ChartJs - stacked bar chart with groups - how to create second x-axis with stack id
- How to draw multiple color bars in a bar chart along a Horizontal Line using chart.js
- how to write labels along with data on top and bottom of each stack in bar chart
- ChartJS - would like to create a mixed chart with horizontal Bar and a dot to represent the answer from the current user
- Drawing a horizontal line on a stacked bar chart on hover (chart js)
- Chart.js Draw a Stacked Bar Chart with Limit Line
More Query from same tag
- Chart.js - Timeline
- How to fix bar width in chartjs?
- Chart.js plugin datalabels - formatter- Add space between thousands
- How can I set the yAxis scale for the chart?
- How to display datasets correctly on a graph using Chart.js
- Angular6 and ng2-charts does not display any charts when i fill data from webservice
- Chart.js margins
- How to use the tooltipTemplate on Chart.JS 2.0
- chart.js label with if statement
- How to put implement chart.js into an existing page django
- how change color of labels of legends of chart.js
- How to give break line in data label
- How to parse a Chart using data from a nested object in ChartJS
- Visualizing iris dataset
- Chart.js scatter charts: Is there a way to indicate that datapoints of two data sets are on top of each other?
- Adding a Label to Chart js Pie Graph
- Center origin of a Scatter Chart
- Legend color not working with randomly generated background colors in chartjs pie chart
- How to rewrite JavaScript currency formatting to abbreviate dollar amount
- Pie chart inside doughnut on same canvas
- chart.js on animation end callback
- Vertical Line chart with ChartJS
- Chartjs - Doughnut chart with multi layer and running value
- Display multiple chart.js charts using for loop in Django template
- Customize fill colors for ChartJS 3.x using beforRender plugin event
- Chart.js bar chart is overflowing its containing element
- Automatic colors assignment in chart.js 2.x doesn't work anymore, used to work in v. 1.x
- Vuejs data not showing properly on mounted
- Not drawing null values using chart.js
- How to convert UNIX timestamp to date using chart.js?