#5 Added more data to stats page and improved CSS
This commit is contained in:
@ -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>
|
Reference in New Issue
Block a user