-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdashboard.js
More file actions
42 lines (38 loc) · 974 Bytes
/
dashboard.js
File metadata and controls
42 lines (38 loc) · 974 Bytes
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
const ctx1 = document.getElementById('chart1').getContext('2d');
const ctx2 = document.getElementById('chart2').getContext('2d');
const chartData = {
labels: ['January', 'February', 'March', 'April', 'May'],
datasets: [
{
label: 'Chart 1 Data',
data: [12, 19, 3, 5, 2],
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1,
},
{
label: 'Chart 2 Data',
data: [5, 10, 15, 5, 20],
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgba(255, 99, 132, 1)',
borderWidth: 1,
},
],
};
const chartOptions = {
scales: {
y: {
beginAtZero: true,
},
},
};
new Chart(ctx1, {
type: 'bar',
data: chartData,
options: chartOptions,
});
new Chart(ctx2, {
type: 'line',
data: chartData,
options: chartOptions,
});