I need to write text into a bar chart in a chart using chart.js
var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data:data, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } }, responsive : true, showTooltips : false, showInlineValues : true, centeredInllineValues : true, tooltipCaretSize : 0, tooltipTemplate : "<%= value %>" });
The above code does not work...
I need something like this:
If you want to render centered text for each element, there is an easier way:
It seems that'getCenterPoint' is not available in version 2.1.3(which you use in your example). I tried it with 2.5.0 and it works
Add this code to your options object:
https://jsfiddle.net/h4p8f5xL/
Update 2
Surround the canvas with a container with the desired width and height
And add the following to your options object