-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdonut-plot.js
More file actions
100 lines (99 loc) · 3.96 KB
/
donut-plot.js
File metadata and controls
100 lines (99 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
document.addEventListener('DOMContentLoaded', function() {
var ctx = document.getElementById("donut-chart").getContext('2d');
var myChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: [
"EU Hosting Expenses",
"US Hosting Expenses",
"Other Hosting Expenses",
"Client Reimbursements",
"Sustainability Fund Contributions",
"Market Research",
"Hosting Revenue",
"Charitable Donations"
],
datasets: [{
// Outer Ring (EXPENDITURES)
backgroundColor: [
'rgba(255, 0, 0, 0.2)', // EU Hosting Expenses
'rgba(255, 40, 0, 0.2)', // US Hosting Expenses
'rgba(255, 80, 0, 0.2)', // Other Hosting Expenses
'rgba(255, 120, 0, 0.2)', // Client Reimbursements
'rgba(255, 160, 0, 0.2)', // Sustainability Fund
'rgba(255, 200, 0, 0.2)', // Market Research
'rgba(0, 200, 0, 0.2)',
'rgba(0, 200, 100, 0.2)'
],
borderColor: [
'rgba(255, 0, 0, 1)', // EU Hosting Expenses
'rgba(255, 40, 0, 1)', // US Hosting Expenses
'rgba(255, 80, 0, 1)', // Other Hosting Expenses
'rgba(255, 120, 0, 1)', // Client Reimbursements
'rgba(255, 160, 0, 1)', // Sustainability Fund
'rgba(255, 200, 0, 1)', // Market Research
'rgba(0, 200, 0, 1)',
'rgba(0, 200, 100, 1)'
],
borderWidth: 1,
data: [436.20, 301.53, 80.07, 206.8, 2500, 300, null, null]
},
{
// Inner Ring (REVENUE)
backgroundColor: [
'rgba(235, 100, 100, 0.2)',
'rgba(255, 0, 0, 0.2)',
'rgba(255, 0, 100, 0.2)',
'rgba(235, 162, 54, 0.2)',
'rgba(256, 100, 0, 0.2)',
'rgba(256, 20, 0, 0.2)',
'rgba(0, 200, 0, 0.2)',
'rgba(0, 200, 100, 0.2)'
],
borderColor: [
'rgba(235, 100, 100, 1)',
'rgba(255, 0, 0, 1)',
'rgba(255, 0, 100, 1)',
'rgba(235, 162, 54, 1)',
'rgba(256, 100, 0, 1)',
'rgba(256, 20, 0, 1)',
'rgba(0, 200, 0, 1)',
'rgba(0, 200, 100, 1)'
],
borderWidth: 1,
data: [null, null, null, null, null, null, 1034.89, 2889.98]
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
cutoutPercentage: 50, // Adjust for larger or smaller hole
plugins:
{
legend: {
display: true,
labels: {
color: 'white'
}
},
tooltip: {
enabled: true,
bodyColor: 'white',
titleColor: 'white',
callbacks: {
label: function(context) {
let label = context.label || '';
if (label) {
label += ': ';
}
if (context.parsed !== null) {
label += new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 2, maximumFractionDigits: 2}).format(context.parsed);
}
return label;
}
}
}
}
}
});
});