#5 Added ability to correlate data into graph
This commit is contained in:
parent
80749daa01
commit
8653d2caa9
@ -18,7 +18,10 @@ def stats_index():
|
|||||||
""" Main page to view all of the statistics for the site """
|
""" Main page to view all of the statistics for the site """
|
||||||
db = StatsController()
|
db = StatsController()
|
||||||
data = db.read()
|
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/<int:id>')
|
@blueprint.route('/product/<int:id>')
|
||||||
|
@ -11,12 +11,12 @@
|
|||||||
const ctx = document.getElementById('myChart');
|
const ctx = document.getElementById('myChart');
|
||||||
|
|
||||||
new Chart(ctx, {
|
new Chart(ctx, {
|
||||||
type: 'bar',
|
type: 'line',
|
||||||
data: {
|
data: {
|
||||||
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
|
labels: {{data}},
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: '# of Votes',
|
label: '# of Votes',
|
||||||
data: [12, 19, 3, 5, 2, 3],
|
data: {{data}},
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user