diff --git a/controllers/web/stats.py b/controllers/web/stats.py index 879ccd6..485c447 100644 --- a/controllers/web/stats.py +++ b/controllers/web/stats.py @@ -18,7 +18,10 @@ def stats_index(): """ Main page to view all of the statistics for the site """ db = StatsController() data = db.read() - return render_template("index.html", content="stats.html", data=data) + test = list(map(lambda d: d.productID, data)) + for i in test: + print(i) + return render_template("index.html", content="stats.html", data=test) @blueprint.route('/product/') diff --git a/templates/stats.html b/templates/stats.html index 4b9e248..89cf9fa 100644 --- a/templates/stats.html +++ b/templates/stats.html @@ -11,22 +11,22 @@ const ctx = document.getElementById('myChart'); new Chart(ctx, { - type: 'bar', + type: 'line', data: { - labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'], - datasets: [{ - label: '# of Votes', - data: [12, 19, 3, 5, 2, 3], - borderWidth: 1 - }] + labels: {{data}}, + datasets: [{ + label: '# of Votes', + data: {{data}}, + borderWidth: 1 + }] }, options: { - scales: { - y: { - beginAtZero: true + scales: { + y: { + beginAtZero: true + } } } - } });