-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscriptstatistics.js
More file actions
90 lines (87 loc) · 2.6 KB
/
Copy pathscriptstatistics.js
File metadata and controls
90 lines (87 loc) · 2.6 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
document.addEventListener('DOMContentLoaded', () => {
// Goal Progress Chart
const ctx1 = document.getElementById('goalProgressChart').getContext('2d');
new Chart(ctx1, {
type: 'doughnut',
data: {
labels: ['Completed', 'Remaining'],
datasets: [{
label: 'Goal Progress',
data: [75, 25],
backgroundColor: ['#4CAF50', '#FFC107'],
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'bottom',
},
}
}
});
// Monthly Savings Chart
const ctx2 = document.getElementById('monthlySavingsChart').getContext('2d');
new Chart(ctx2, {
type: 'bar',
data: {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{
label: 'Monthly Savings',
data: [200, 150, 300, 250, 400, 350, 500],
backgroundColor: '#4CAF50',
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true
}
},
plugins: {
legend: {
position: 'bottom',
},
}
}
});
// Investment Growth Chart
const ctx3 = document.getElementById('investmentGrowthChart').getContext('2d');
new Chart(ctx3, {
type: 'line',
data: {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{
label: 'Investment Growth',
data: [1000, 1100, 1200, 1300, 1250, 1400, 1500],
borderColor: '#4CAF50',
fill: false,
tension: 0.1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true
}
},
plugins: {
legend: {
position: 'bottom',
},
}
}
});
});
const goBackButton = document.getElementById('goBackButton');
goBackButton.addEventListener('click', () => {
// Go back in history
window.history.back();
});