-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
45 lines (40 loc) · 1.05 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
const sidebar = document.querySelector('.sidebar');
const menuBtn = document.querySelector('.hamburger');
const menuIcon = document.querySelector('.hamburger img');
const mainPage = document.querySelector('section');
menuBtn.addEventListener('click', () => {
sidebar.classList.toggle('active');
// toggle close icon
if(sidebar.classList.contains('active')) {
menuIcon.src = './icons/close.svg';
} else {
menuIcon.src = './icons/hamburger.svg';
}
});
mainPage.addEventListener('click', () => {
sidebar.classList.remove('active');
// change menuicon
menuIcon.src = './icons/hamburger.svg';
});
// chart
var xValues = [0,'Jan','Feb','Mar','Apr','May'];
var yValues = [7,6.4,8.3,9,8.5,9,9.9];
new Chart("myChart", {
type: "line",
data: {
labels: xValues,
datasets: [{
fill: true,
lineTension: 0,
backgroundColor: "#1175f6",
borderColor: "#a32eb3",
data: yValues
}]
},
options: {
legend: {display: false},
scales: {
yAxes: [{ticks: {min: 6, max:9.5}}],
}
}
});