#5 Added scripts to get charts in htrml file

This commit is contained in:
Luke Else 2024-02-02 17:43:03 +00:00
parent 8f0e995471
commit 80749daa01

View File

@ -1,5 +1,35 @@
<link rel="stylesheet" href="{{ url_for('static', filename='css/products.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/products.css') }}">
<div>
<canvas id="myChart"></canvas>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const ctx = document.getElementById('myChart');
new Chart(ctx, {
type: 'bar',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
<div class="product-container"> <div class="product-container">
{% if data != None %} {% if data != None %}
{% for stat in data %} {% for stat in data %}