Skip to content

Commit

Permalink
4.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelbart committed Sep 7, 2020
1 parent f6da0ea commit 84eb944
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

// show percentages on doughnuts
// since 4.0.1
if ('doughnut' === response.type) {
if ("doughnut" === response.type) {
response.options.tooltips = {
callbacks: {
label: function (tooltipItem, data) {
Expand All @@ -93,7 +93,9 @@
var total = 0;
var pro = data.datasets[0].data[tooltipItem.index];
var contra = data.datasets[1].data[tooltipItem.index];
var total = pro + contra;

total = pro + contra;

var dataset = data.datasets[tooltipItem.datasetIndex];
var currentValue = dataset.data[tooltipItem.index];
var percentage = parseFloat((currentValue / total * 100).toFixed(1));
Expand All @@ -104,7 +106,7 @@
return data.labels[tooltipItem[0].index];
},
}
}
};
}

new Chart(canvas, response);
Expand Down

0 comments on commit 84eb944

Please sign in to comment.