-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
56 lines (51 loc) · 1.76 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div>
<canvas id="myChart"></canvas>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.8.5/d3.min.js" integrity="sha512-M7nHCiNUOwFt6Us3r8alutZLm9qMt4s9951uo8jqO4UwJ1hziseL6O3ndFyigx6+LREfZqnhHxYjKRJ8ZQ69DQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<!-- Your HTML and script tags here -->
<script>
const data = "data.csv";
const ctx = document.getElementById('myChart');
d3.csv(data).then(function(datapoints) {
const labels = [];
const downloadCounts = [];
const backgroundColors = [];
for (let i = 0; i < datapoints.length; i++) {
labels.push(datapoints[i].AppDownloadDate);
downloadCounts.push(datapoints[i].DownloadCount);
backgroundColors.push(i % 2 === 0 ? 'rgba(0, 80, 0, 0.7)' : 'rgba(0, 250, 0, 1.0)');
}
new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Download Count',
data: downloadCounts,
borderWidth: 1,
backgroundColor: backgroundColors,
}]
},
options: {
scales: {
y: {
beginAtZero: true,
max: 300 // Set the maximum value for the y-axis
}
}
}
});
});
</script>
</body>
</html>
<!-- comment -->