-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
68 lines (66 loc) · 1.45 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
let chart = null;
let drawChart = () => {
const ctx = document.getElementById('cchart');
const context = ctx.getContext('2d');
context.clearRect(0, 0, ctx.width, ctx.height);
if (chart) chart.destroy();
Chart.defaults.font.size = 20;
Chart.defaults.font.family = "'Courier New', Courier, monospace";
chart = new Chart(ctx, {
type: 'line',
data: {
labels: ['2024', '2025', '2026', '2027', '2028', '2029'],
datasets: [
{
data: [1, 3, 1.5, 6, 2, 3],
borderColor: 'red',
fill: false,
label: 'Transaction Fees',
},
{
data: [1, 1, 1, 1, 1, 1],
borderColor: 'blue',
fill: false,
label: 'TK-Battery',
},
],
},
options: {
animations: {
tension: {
duration: 1000,
easing: 'easeInBounce',
from: 0.25,
to: 0,
loop: false,
},
},
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
ticks: {
color: 'black',
},
grid: {
color: 'rgba(0, 0, 0, 0.25)',
},
},
y: {
suggestedMin: 0,
suggestedMax: 6,
ticks: {
color: 'black',
},
grid: {
color: 'rgba(0, 0, 0, 0.25)',
},
},
},
},
});
};
drawChart();
window.onresize = () => {
drawChart();
};