smilecheck / templates /customresult.html
abhicodes's picture
Upload 63 files
b75f547
raw
history blame
1.98 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Custom Result</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
<div style="width: 75%;">
<button onclick="getres()"> Get Result </button>
<div id="chart" style="display:none"><canvas id="myChart"></canvas></div>
</div>
<script>
// Display Configuration
function getres() {
var element = document.getElementById("chart");
element.style.display = "block";
}
// Chart configuration
var ctx = document.getElementById('myChart').getContext('2d');
var chart = new Chart(ctx, {
type: 'bar',
data: {
labels: {{ques|safe }},
datasets: [{
label: ' Your Data',
data: {{res2}},
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)'
],
borderWidth: 1
},
{
label: ' Compared to Average',
data: [70, 50, 48, 89],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)'
],
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
},
scaleLabel: {
display: true,
labelString: '% Compared to Average'
}
}],
xAxes: [{
scaleLabel: {
display: true,
labelString: 'Data Points'
}
}]
}
}
});
</script>
</body>
</html>