Browse Source

almost finished stats page

pull/10/head
crunch 3 months ago
parent
commit
1615db0323
2 changed files with 13 additions and 7 deletions
  1. +12
    -6
      Consulta_project/landing/static/js/stats.js
  2. +1
    -1
      Consulta_project/polls/templates/polls/stats.html

+ 12
- 6
Consulta_project/landing/static/js/stats.js View File

@@ -58,14 +58,15 @@ function createBarChart(series, labels, target_id) {
labels: labels,
datasets: [{
label: 'Number of votes',
backgroundColor: 'rgb(255, 99, 132)',
borderColor: 'rgb(255, 99, 132)',
backgroundColor: 'rgb(0,188,140)',
borderColor: '#282d32',
data: series,
}],
},

// Configuration options go here
options: {
events: null,
scales: {
yAxes: [{
ticks: {
@@ -88,14 +89,19 @@ function createPieChart(series, labels, target_id) {
data: {
labels: labels,
datasets: [{
backgroundColor: 'rgb(255, 99, 132)',
borderColor: 'rgb(255, 99, 132)',
data: series
backgroundColor: 'rgb(0,188,140)',
borderColor: '#282d32',
data: series,
}]
},

// Configuration options go here
options: {}
options: {
events: null,
tooltips: {
mode: 'point'
}
}
});
}



+ 1
- 1
Consulta_project/polls/templates/polls/stats.html View File

@@ -25,7 +25,7 @@
<h3>"{{ question.question_string }}"</h3>
</div>
</div>
<div class="row d-flex justify-content-center" style="margin-top: 15px;margin-bottom: 15px;">
<div class="row d-flex justify-content-center">
<div class="col" style="margin-top: 15px;margin-bottom: 15px;">
<canvas id="chart-{{ question.id }}-bar" data-id={{ question.id }}></canvas>
</div>


Loading…
Cancel
Save