File size: 6,194 Bytes
4f591e5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
function showModal(content) {
document.getElementById('content-text').innerText = content;
$('#contentModal').modal('show');
}
function selectAll(source) {
const checkboxes = document.querySelectorAll('input[type="checkbox"]');
for (let i = 0; i < checkboxes.length; i++) {
if (checkboxes[i] !== source)
checkboxes[i].checked = source.checked;
}
}
function initializeCharts(scoresTR, scoresCC, scoresLR, scoresGRA, creationTimes) {
const essayNumbers = [...Array(scoresTR.length).keys()].map(x => x + 1); // Array from 1 to the length of scores
const rubricChartData = {
labels: essayNumbers,
datasets: [
{
label: 'Task Response',
data: scoresTR,
borderColor: 'rgba(54, 162, 235, 1.0)',
backgroundColor: 'rgba(54, 162, 235, 0.6)',
fill: false,
pointRadius: 5
},
{
label: 'Coherence and Cohesion',
data: scoresCC,
borderColor: 'rgba(255, 99, 132, 1.0)',
backgroundColor: 'rgba(255, 99, 132, 0.6)',
fill: false,
pointRadius: 5
},
{
label: 'Lexical Resource',
data: scoresLR,
borderColor: 'rgba(75, 192, 192, 1.0)',
backgroundColor: 'rgba(75, 192, 192, 0.6)',
fill: false,
pointRadius: 5
},
{
label: 'Grammatical Range and Accuracy',
data: scoresGRA,
borderColor: 'rgba(153, 102, 255, 1.0)',
backgroundColor: 'rgba(153, 102, 255, 0.6)',
fill: false,
pointRadius: 5
}
]
};
const rubricChartOptions = {
responsive: true,
plugins: {
tooltip: {
callbacks: {
label: function (tooltipItem) {
const index = tooltipItem.dataIndex;
switch (tooltipItem.dataset.label) {
case 'Task Response':
return `Task Response Score: ${tooltipItem.raw}, Time: ${creationTimes[index]}`;
case 'Coherence and Cohesion':
return `Coherence and Cohesion Score: ${tooltipItem.raw}, Time: ${creationTimes[index]}`;
case 'Lexical Resource':
return `Lexical Resource Score: ${tooltipItem.raw}, Time: ${creationTimes[index]}`;
case 'Grammatical Range and Accuracy':
return `Grammatical Range and Accuracy Score: ${tooltipItem.raw}, Time: ${creationTimes[index]}`;
default:
return `Score: ${tooltipItem.raw}, Time: ${creationTimes[index]}`;
}
}
}
},
legend: {
display: true,
labels: {
color: 'white',
padding: 20
},
position: 'top',
align: 'center'
}
},
scales: {
x: {
title: {
display: true,
text: 'Essay Number',
color: 'white'
},
ticks: {
color: 'white'
},
grid: {
display: true
}
},
y: {
title: {
display: true,
text: 'Score',
color: 'white'
},
ticks: {
color: 'white'
},
min: 0,
max: 10,
grid: {
display: true,
color: 'rgba(255, 255, 255, 0.2)'
}
}
}
};
new Chart(document.getElementById('RubricChart'), {
type: 'line',
data: rubricChartData,
options: rubricChartOptions
});
const essaysPerDay = {};
creationTimes.forEach(time => {
const date = time.split(' ')[0];
essaysPerDay[date] = (essaysPerDay[date] || 0) + 1;
});
const sortedEssaysArray = Object.entries(essaysPerDay).sort((a, b) => new Date(a[0]) - new Date(b[0]));
const sortedEssaysPerDay = Object.fromEntries(sortedEssaysArray);
const dates = Object.keys(sortedEssaysPerDay);
const essayCounts = Object.values(sortedEssaysPerDay);
const essayCountChartData = {
labels: dates,
datasets: [{
label: 'Essays Per Day',
data: essayCounts,
borderColor: 'rgba(255, 165, 0, 1.0)',
backgroundColor: 'rgba(145, 128, 128, 0.5)',
fill: true,
pointRadius: 5
}]
};
const essayCountChartOptions = {
responsive: true,
plugins: {
legend: {
display: false
}
},
scales: {
x: {
title: {
display: true,
text: 'Date',
color: 'white'
},
ticks: {
color: 'white'
},
grid: {
display: true
}
},
y: {
title: {
display: true,
text: 'Number of Essays',
color: 'white'
},
ticks: {
color: 'white'
},
grid: {
display: true,
color: 'rgba(255, 255, 255, 0.2)' // Light grid lines
}
}
}
};
new Chart(document.getElementById('EssayCountChart'), {
type: 'bar',
data: essayCountChartData,
options: essayCountChartOptions
});
}
|