55 lines
1.1 KiB
Text
55 lines
1.1 KiB
Text
|
<h2><%= name %></h2>
|
||
|
<span>Total Participants: <b><%= total_submissions %></b></span>
|
||
|
<% if show_result { %>
|
||
|
<br/>
|
||
|
<span>The correct answer is: <b><%= correct_answer %></b></span>
|
||
|
<% } %>
|
||
|
|
||
|
<canvas id="myChart"></canvas>
|
||
|
|
||
|
|
||
|
<script>
|
||
|
var ctx = document.getElementById('myChart');
|
||
|
var chart = new Chart(ctx, {
|
||
|
type: 'bar',
|
||
|
data: {
|
||
|
labels: [
|
||
|
<% for answer in answers.iter() { %>
|
||
|
"<%= answer %>",
|
||
|
<% } %>
|
||
|
],
|
||
|
datasets: [{
|
||
|
label: "# der Stimmen",
|
||
|
data: [
|
||
|
<% for submissions in submissions.iter() { %>
|
||
|
<%= submissions %>,
|
||
|
<% } %>
|
||
|
],
|
||
|
borderWidth: 1
|
||
|
}]
|
||
|
},
|
||
|
options: {
|
||
|
legend: {
|
||
|
display: false
|
||
|
},
|
||
|
scales: {
|
||
|
x: {
|
||
|
ticks: {
|
||
|
font: {
|
||
|
size: 64
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
y: {
|
||
|
beginAtZero: true,
|
||
|
ticks: {
|
||
|
font: {
|
||
|
size:24
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
</script>
|