diff --git a/backend/app/dashboard/static/dashboard-progress.js b/backend/app/dashboard/static/dashboard-progress.js
index 5ff7aab..9b83f48 100644
--- a/backend/app/dashboard/static/dashboard-progress.js
+++ b/backend/app/dashboard/static/dashboard-progress.js
@@ -43,6 +43,12 @@ function createHandsontable(data, columns_list) {
function updateHandsontable(data, columns_list) {
data = filterStudentsInClass(data);
+ ret = generateMatrix(data, columns_list)
+ zvals = ret[1]
+ data_h[0]['x'] = columns_list.slice(1);
+ data_h[0]['z'] = zvals;
+ Plotly.redraw('chart');
+
let dataSchema = getDataSchema(columns_list);
hot.updateSettings({
data: data,
@@ -142,6 +148,29 @@ function generateTagView() {
});
}
+function generateMatrix(tableData, columns){
+ nulls = new Array(columns.length-1).fill(null)
+ zvals = []
+ usernames = []
+ tableData.forEach(row => {
+ studentvals = [...nulls]
+ Object.entries(row).forEach((val) => {
+ if (val[0] == "Name") {
+ usernames.push(val[1])
+ }
+ else{
+ idx = columns.indexOf(val[0])-1
+ if (idx >= 0){
+ studentvals[idx] = val[1]
+ }
+ }
+ });
+ zvals.push(studentvals)
+ });
+ console.log(usernames)
+ return [usernames.reverse(), zvals.reverse()]
+}
+
var tags = new Set();
var table;
var columns;
@@ -180,4 +209,51 @@ document.addEventListener("DOMContentLoaded", function () {
tableData = structuredClone(data);
createHandsontable(tableData, columns);
+
+ ret = generateMatrix(tableData, columns)
+ usernames = ret[0]
+ zvals = ret[1]
+ data_h = [
+ {
+ x: columns.slice(1),
+ y: usernames,
+ z: zvals,
+ type: 'heatmap',
+ hovertemplate : 'Exercício: %{x}
Aluno: %{y}
Nota: %{z}