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-14 21:59:31 +00:00
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/forms.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 >
|
2024-02-14 21:59:31 +00:00
|
|
|
<div class="form-row">
|
2024-02-12 21:44:40 +00:00
|
|
|
<a href="?prev_days=7">1 Week</a>
|
|
|
|
<a href="?prev_days=14">2 Weeks</a>
|
|
|
|
<a href="?prev_days=31">1 Month</a>
|
|
|
|
</div>
|
2024-02-09 22:01:25 +00:00
|
|
|
</div>
|
|
|
|
<div>
|
2024-02-11 15:52:12 +00:00
|
|
|
<p><b>Age:</b> {{data['age']}}</p>
|
2024-02-12 17:21:13 +00:00
|
|
|
<p><b>Ranking:</b> #{{data['ranking']}} in {{data['category']}}</p>
|
2024-02-11 15:52:12 +00:00
|
|
|
<p><b>Stock Level:</b> {{data['stocklevel']}}</p>
|
|
|
|
<p><b>Total Views:</b> {{data['views']['total']}}</p>
|
2024-02-09 22:01:25 +00:00
|
|
|
</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-11 15:52:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Remove the need for a submit button on the graph buttons
|
|
|
|
const form = document.getElementById("timeframe_form");
|
|
|
|
const rbs = form.querySelectorAll("input[type='radio']");
|
|
|
|
console.log(rbs)
|
|
|
|
console.log(form)
|
|
|
|
rbs.forEach((input) => {
|
|
|
|
input.addEventListener("change", () => {
|
|
|
|
form.submit();
|
|
|
|
});
|
|
|
|
});
|
2024-02-09 22:01:25 +00:00
|
|
|
</script>
|