function sparkbar (max) {
return (x) => htl. html `<div style="
background: ${ corbar (x)} ;
color: black;
font: 10px/1.6;
width: ${ 100 * x / 10 } %;
float: left;
padding-left: 3px;
box-sizing: border-box;
overflow: visible;
display: flex;
justify-content: flex-start;"> ${ x} `
}
function makera (x) {
let num = x. toString ();
var stringValue = parseInt (x. toString (). replace (/,/g , "" ));
return (stringValue);
}
function isString (value) {
return typeof value === 'string' || value instanceof String
}
function corbar (x) {
return x >= 7 ? "#78B7D0" : "#FFDC7F"
}
function leftFillNum (num, targetLength) {
return num. toString (). padStart (targetLength, "0" );
}
Inputs. table (provas, {
sort : "RA" ,
reverse : true ,
columns : ["RA" , "NotaFinal" , "Status" , "AV1" , "AV2" , "P2" , "ListaAvg" , "Add_List_Atrasada" ],
header : {
RA : "RA" ,
NotaFinal : "NotaFin" ,
Status : "Status" ,
AV1 : "Nota 1º Bim" ,
AV2 : "Nota 2º Bim" ,
P2 : "2ª Prova" ,
ListaAvg : "MedListas" ,
Add_List_Atrasada : "Repescagem Lista"
},
align : {
NotaFinal : "left" ,
Status : "center" ,
RA : "right"
},
width : {
RA : 80 ,
NotaFinal : 350 ,
Status : 120 ,
AV1 : 100 ,
AV2 : 100 ,
P2 : 80 ,
ListaAvg : 80 ,
Add_List_Atrasada : 80
},
rows : 30 ,
maxWidth : 1200 ,
maxHeight : 750 ,
multiple : false ,
layout : "fixed" ,
format : {
NotaFinal : sparkbar (d3. max (provas, d => d. NotaFinal )),
RA : (x) => isString (x) ? x. replace (/,/g , "" ) : leftFillNum (x, 6 )
}
})