2024-02-02 16:42:19 +00:00
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/products.css') }}">
|
2024-02-09 22:01:25 +00:00
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/stats.css') }}">
|
2024-02-02 17:43:03 +00:00
|
|
|
|
2024-02-09 22:01:25 +00:00
|
|
|
<div class="stats">
|
|
|
|
<div>
|
|
|
|
<canvas id="myChart" width="800px" height="500px"></canvas>
|
|
|
|
<br >
|
|
|
|
<form method="GET">
|
|
|
|
<input type="radio" id="7days" name="prev_days" value=7>
|
|
|
|
<label for="7days">7 Days</label><br>
|
|
|
|
<input type="radio" id="31days" name="prev_days" value=31>
|
|
|
|
<label for="31days">31 Days</label><br>
|
|
|
|
<input type="radio" id="1year" name="prev_days" value=365>
|
|
|
|
<label for="1year">1 Year</label>
|
|
|
|
<input type="submit">
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p>Age: {{data['age']}}</p>
|
|
|
|
<p>Ranking: {{data['ranking']}}</p>
|
|
|
|
<p>Stock Level: {{data['stocklevel']}}</p>
|
|
|
|
<p>Total Views: {{data['views']['total']}}</p>
|
|
|
|
</div>
|
2024-02-02 17:43:03 +00:00
|
|
|
</div>
|
|
|
|
|
2024-02-09 22:01:25 +00:00
|
|
|
|
|
|
|
|
2024-02-02 17:43:03 +00:00
|
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
const ctx = document.getElementById('myChart');
|
|
|
|
|
|
|
|
new Chart(ctx, {
|
2024-02-02 21:01:29 +00:00
|
|
|
type: 'line',
|
2024-02-02 17:43:03 +00:00
|
|
|
data: {
|
2024-02-09 22:01:25 +00:00
|
|
|
labels: {{data['views']['headings']|safe}},
|
2024-02-02 21:01:29 +00:00
|
|
|
datasets: [{
|
2024-02-06 19:15:44 +00:00
|
|
|
label: '# of Views',
|
2024-02-09 22:01:25 +00:00
|
|
|
data: {{data['views']['data']}},
|
2024-02-02 21:01:29 +00:00
|
|
|
borderWidth: 1
|
|
|
|
}]
|
2024-02-02 17:43:03 +00:00
|
|
|
},
|
|
|
|
options: {
|
2024-02-02 21:01:29 +00:00
|
|
|
scales: {
|
|
|
|
y: {
|
2024-02-06 19:15:44 +00:00
|
|
|
title: {
|
|
|
|
display: true,
|
|
|
|
text: "Num Views"
|
|
|
|
},
|
2024-02-02 21:01:29 +00:00
|
|
|
beginAtZero: true
|
2024-02-06 19:15:44 +00:00
|
|
|
},
|
|
|
|
x: {
|
|
|
|
title: {
|
|
|
|
display: true,
|
|
|
|
text: "Prev Days"
|
|
|
|
},
|
2024-02-02 21:01:29 +00:00
|
|
|
}
|
2024-02-02 17:43:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2024-02-09 22:01:25 +00:00
|
|
|
</script>
|