PluginProbe
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce / 1.6.7
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce v1.6.7
1.17.10 1.17.9 1.17.8 1.17.7 1.17.6 1.17.5 1.17.4 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.3.0 1.3.1 1.3.11 1.3.12 1.3.13 1.3.14 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 All 144 releases
erp / modules / accounting / assets / js / payment_chart.js

payment_chart.js in ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce 1.6.7, at modules/accounting/assets/js/payment_chart.js

69 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var colors = ['#55D8FE', '#FF8373'],
2 labels = ['Recieved', 'Outstanding'],
3 data = [794, 458],
4 bgColor = colors,
5 dataChart = {
6 labels: labels,
7 datasets: [{
8 data: data,
9 backgroundColor: bgColor
10 }]
11 },
12 config = {
13 type: 'doughnut',
14 data: dataChart,
15 options: {
16 maintainAspectRatio: true,
17 cutoutPercentage: 45,
18 legend: {
19 display: false
20 },
21 // generate custom labels
22 legendCallback: function(chart) {
23 var text = [];
24 text.push('<ul class="chart-labels-list">');
25 if (chart.data.datasets.length) {
26 for (var i = 0; i < chart.data.datasets[0].data.length; ++i) {
27 text.push('<li><div class="label-icon-wrapper">\
28 <span class="chart-label-icon" style="background-color:' + chart.data.datasets[0].backgroundColor[i] + '"></span>\
29 </div><div class="chart-label-values">');
30 if (chart.data.datasets[0].data[i]) {
31 text.push('<span class="chart-value">$ ' + chart.data.datasets[0].data[i] + '</span><br>');
32 }
33 if (chart.data.labels[i]) {
34 text.push('<span class="chart-label">' + chart.data.labels[i] + '</span>');
35 }
36 text.push('</div></li>');
37 }
38 }
39 text.push('</ul>');
40
41 return text.join("");
42 },
43 // generate custom tooltips
44 tooltips: {
45 yPadding: 10,
46 callbacks: {
47 label: function(tooltipItem, data) {
48 var total = 0;
49 data.datasets[tooltipItem.datasetIndex].data.forEach(function(element /*, index, array*/ ) {
50 total += element;
51 });
52 var value = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
53 var percentTxt = Math.round(value / total * 100);
54 return data.labels[tooltipItem.index] + ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index] + ' (' + percentTxt + '%)';
55 }
56 }
57 }
58 }
59 },
60
61 payment_chart_ctx = document.getElementById("payment_chart").getContext("2d"),
62 payment_chart = new Chart(payment_chart_ctx, config),
63
64 payment_legend = payment_chart.generateLegend(),
65 payment_legendHolder = document.getElementById("payment_legend");
66
67 // legendHolder.innerHTML = legend + '<div style="font-size: smaller">Total : <strong>' + 1703 + '</strong></div>';
68 payment_legendHolder.innerHTML = payment_legend
69