extra dummy question added.

This commit is contained in:
Bram Barbieri
2024-03-31 20:27:33 +02:00
parent cf0a6c6565
commit 3435bdaaab
2 changed files with 42 additions and 2 deletions

View File

@@ -83,8 +83,8 @@
<h2>Question 2</h2>
<canvas id="chart2"></canvas>
<!-- <h2>Question 3</h2>
<canvas id="chart3"></canvas> -->
<h2>Question 3</h2>
<canvas id="chart3"></canvas>
<!-- Add more questions and canvas elements as needed -->
</div>

View File

@@ -41,6 +41,25 @@ const question2Data = {
}]
};
const question3Data = {
labels: ['Option A', 'Option B', 'Option C'],
datasets: [{
label: 'Responses',
data: [30, 30, 30],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)'
],
borderWidth: 1
}]
};
// Chart configurations for each question
const chartConfig1 = {
type: 'pie',
@@ -79,6 +98,25 @@ const chartConfig2 = {
}
}
};
const chartConfig3 = {
type: 'pie',
data: question3Data,
options: {
responsive: true,
legend: {
position: 'top',
},
title: {
display: true,
text: 'Question 3 Responses'
},
animation: {
animateScale: true,
animateRotate: true
}
}
};
// const chartConfig3 = {
// type: 'pie',
// data: question3Data.questionData(),
@@ -105,6 +143,8 @@ const myChart1 = new Chart(ctx1, chartConfig1);
const ctx2 = document.getElementById('chart2').getContext('2d');
const myChart2 = new Chart(ctx2, chartConfig2);
const ctx3 = document.getElementById('chart3').getContext('2d');
const myChart3 = new Chart(ctx3, chartConfig3);
// const ctx3 = document.getElementById('chart3').getContext('2d');
// const myChart3 = new Chart(ctx3, chartConfig3);