#5 Latest views are now displayed on the stats page

This commit is contained in:
2024-02-06 19:15:44 +00:00
parent 3a08686fc3
commit f254c011b6
4 changed files with 46 additions and 19 deletions

View File

@ -46,6 +46,7 @@
{% if product.quantityAvailable > 0 %}
<div class="product-instock">In Stock</div>
<div class="product-quantity">{{product.quantityAvailable}} Available</div>
<a href="{{url_for('main.stats.view_product_stats', id=product.id)}}"><input type="button" class="product-add-to-cart" value="View Product Stats"/></a>
{% else %}
<div class="product-nostock">Out of Stock</div>
{% endif %}

View File

@ -2,7 +2,7 @@
<div>
<canvas id="myChart"></canvas>
<canvas id="myChart" width="800px" height="500px"></canvas>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
@ -13,9 +13,9 @@
new Chart(ctx, {
type: 'line',
data: {
labels: {{data}},
labels: {{headings}},
datasets: [{
label: '# of Votes',
label: '# of Views',
data: {{data}},
borderWidth: 1
}]
@ -23,7 +23,17 @@
options: {
scales: {
y: {
title: {
display: true,
text: "Num Views"
},
beginAtZero: true
},
x: {
title: {
display: true,
text: "Prev Days"
},
}
}
}