#5 Added more data to stats page and improved CSS

This commit is contained in:
2024-02-09 22:01:25 +00:00
parent 7c27aa31b6
commit 60cb8d7951
6 changed files with 50 additions and 27 deletions

View File

@ -1,10 +1,30 @@
<link rel="stylesheet" href="{{ url_for('static', filename='css/products.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/stats.css') }}">
<div>
<canvas id="myChart" width="800px" height="500px"></canvas>
<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>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
@ -13,10 +33,10 @@
new Chart(ctx, {
type: 'line',
data: {
labels: {{headings}},
labels: {{data['views']['headings']|safe}},
datasets: [{
label: '# of Views',
data: {{data}},
data: {{data['views']['data']}},
borderWidth: 1
}]
},
@ -38,11 +58,4 @@
}
}
});
</script>
<div class="product-container">
{% if data != None %}
{% for stat in data %}
{% endfor %}
{% endif %}
</div>
</script>