forked from guevaraia/ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
105 lines (102 loc) · 2.02 KB
/
script.js
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
101
102
103
104
105
const ctx = document.getElementById("chart");
Chart.defaults.color = "#FFF";
Chart.defaults.font.family = "Poppins";
new Chart(ctx, {
type: "line",
data: {
labels: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
],
datasets: [
{
label: "Monthly Income",
data: [2235, 3250, 1890, 5400, 20240, 6254, 12325, 4856, 10325, 2254, 22356, 8486],
backgroundColor: "white",
borderColor: "#3DA06E",
borderRadius: 6,
cubicInterpolationMode: 'monotone',
fill: false,
borderSkipped: false,
},
],
},
options: {
interaction: {
intersect: false,
mode: 'index'
},
elements: {
point:{
radius: 0
}
},
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false,
},
title: {
display: true,
text: "Your Income",
padding: {
bottom: 16,
},
font: {
size: 16,
weight: "normal",
},
},
tooltip: {
backgroundColor: "#FDCA49",
bodyColor: "#0E0A03",
yAlign: "bottom",
cornerRadius: 4,
titleColor: "#0E0A03",
usePointStyle: true,
callbacks: {
label: function(context) {
if (context.parsed.y !== null) {
const label = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(context.parsed.y);
return label;
}
return null;
}
}
},
},
scales: {
x: {
border: {
dash: [2, 4],
},
title: {
text: "2023",
},
},
y: {
grid: {
color: "#27292D",
},
border: {
dash: [2, 4],
},
title: {
display: true,
text: "Income [$]",
},
},
},
},
});