-
Notifications
You must be signed in to change notification settings - Fork 0
/
goodandbadrates
84 lines (82 loc) · 2.82 KB
/
goodandbadrates
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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Good and Bad Actions Graph</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.container { max-width: 800px; margin: auto; }
canvas { width: 100%; height: 400px; }
</style>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
<div class="container">
<h1>Good and Bad Actions Over Time</h1>
<canvas id="actionsChart"></canvas>
</div>
<script>
// Data for the graph
const labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const goodActions = [10, 12, 15, 20, 18, 22, 24, 19, 21, 23, 26, 30];
const badActions = [5, 6, 8, 7, 9, 8, 10, 12, 14, 13, 10, 8];
// Create the chart
const ctx = document.getElementById('actionsChart').getContext('2d');
const actionsChart = new Chart(ctx, {
type: 'line', // Line chart
data: {
labels: labels,
datasets: [
{
label: 'Good Actions',
data: goodActions,
borderColor: 'green',
backgroundColor: 'rgba(0, 255, 0, 0.2)',
fill: true,
borderWidth: 2
},
{
label: 'Bad Actions',
data: badActions,
borderColor: 'red',
backgroundColor: 'rgba(255, 0, 0, 0.2)',
fill: true,
borderWidth: 2
}
]
},
options: {
scales: {
x: {
beginAtZero: true,
title: {
display: true,
text: 'Months'
}
},
y: {
beginAtZero: true,
title: {
display: true,
text: 'Number of Actions'
}
}
},
plugins: {
legend: {
display: true,
position: 'top'
},
tooltip: {
callbacks: {
label: function(context) {
return context.dataset.label + ': ' + context.raw;
}
}
}
}
}
});
</script>
</body>
</html>