-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdisplayChart.js
37 lines (33 loc) · 949 Bytes
/
displayChart.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
function displayChart() {
let titleString = "";
if(chartX.length == 0) titleString = "No data found!";
if(myChart) {
myChart.destroy();
}
const ctx = document.getElementById('currencyChart').getContext('2d');
myChart = new Chart(ctx, {
type: 'line',
data: {
labels: chartX,
datasets: [{
label: 'Currency Rate',
data: chartY,
backgroundColor: 'rgba(154.5, 0, 0, 0.2)',
borderColor: 'rgba(154.5, 0, 0, 1)',
borderWidth: 1
}]
},
options: {
title: {
display: true,
text: titleString,
fontSize: 20
},
scales: {
y: {
beginAtZero: true
}
}
}
});
}