0
if I correct understood, try to fix it, add to centerCallback
,
var value = dataContext.totalValue;
pieElem.innerHTML =
'<div id="myDiv" style="position:absolute;text-align:center;font-size:16px;">' +
'Total ' + value +
'</div>';
- Chartjs-ChartJS get data from Controller
- Chartjs-Chart.js Charts not loading until hard refresh [Laravel] [Laravel Charts]
0
Could you try this
function( options ){
// will hold the total value, must be global variable
var total;
Add below statement in this.pieSliceLabel = function(dataContext){}
percent = Math.round(dataContext.value/dataContext.totalValue*100);
total = dataContext.totalValue; //assign to global variable
Update the below innerHTML code in this.centerCallback = function(dataContext){}
//updated element
pieElem.innerHTML =
'<div id="myDiv" style="position:absolute;text-align:center;font-size:16px;">' +
'Total' + total +
'</div>';
- Chartjs-Chart.js : Module parse failed when using the latest version of chart.js
- Chartjs-Fetch more data for line chart onZoom/onPan issues
Source:stackexchange.com