0👍
Well if you have to pull data from the DOM here is the possible solution (not the prettiest one, but it works… ). Give the corresponding HTML elements ids e.g. amount and total.
var total = document.getElementById("total").innerText;
var amount = document.getElementById("amount").innerText / total * 100;
var left = 100 - amount;
if ( amount && total ) {
data.datasets[0].data = [amount, left];
}
And do some styling…
Source:stackexchange.com