Formatting after learning some style; improve functions later
This commit is contained in:
14
docs/main.js
14
docs/main.js
@@ -9,7 +9,7 @@ if(chartDiv.getAttribute('value') == 'invisible'){
|
|||||||
var gradeChart;
|
var gradeChart;
|
||||||
const ctx = document.getElementById("gradeBar");
|
const ctx = document.getElementById("gradeBar");
|
||||||
const gradeLabels = ["A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D+", "D", "D-", "F"];
|
const gradeLabels = ["A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D+", "D", "D-", "F"];
|
||||||
|
const backgroundColor = ["rgb(98, 244, 54)", "rgb(129, 231, 10)", "rgb(151, 218, 0)", "rgb(168, 204, 0)", "rgb(181, 190, 0)", "rgb(191, 176, 0)", "rgb(199, 162, 0)", "rgb(205, 148, 0)", "rgb(209, 133, 0)", "rgb(211, 119, 0)", "rgb(210, 105, 0)", "rgb(208, 91, 23)", "rgb(204, 78, 36)", "rgb(198, 66, 46)", "rgb(190, 54, 54)", ""];
|
||||||
/*
|
/*
|
||||||
Parse the input form and class data
|
Parse the input form and class data
|
||||||
*/
|
*/
|
||||||
@@ -23,7 +23,9 @@ async function parseName() {
|
|||||||
if (!fiveDigit) {
|
if (!fiveDigit) {
|
||||||
await fetch('https://derec4.github.io/ut-grade-data/2022prefixes.json')
|
await fetch('https://derec4.github.io/ut-grade-data/2022prefixes.json')
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => { departments = data; });
|
.then(data => {
|
||||||
|
departments = data;
|
||||||
|
});
|
||||||
if (!className && !classNum && !department) {
|
if (!className && !classNum && !department) {
|
||||||
alert("At least fill out the form...");
|
alert("At least fill out the form...");
|
||||||
return;
|
return;
|
||||||
@@ -81,7 +83,9 @@ async function PapaParse(department, num, name, sem, unique) {
|
|||||||
}
|
}
|
||||||
await fetch(url)
|
await fetch(url)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => { cData = data; });
|
.then(data => {
|
||||||
|
cData = data;
|
||||||
|
});
|
||||||
let selectedClass = '';
|
let selectedClass = '';
|
||||||
if (unique) {
|
if (unique) {
|
||||||
selectedClass = cData.filter(cData => cData['Section Number'] == unique);
|
selectedClass = cData.filter(cData => cData['Section Number'] == unique);
|
||||||
@@ -154,7 +158,7 @@ async function PapaParse(department, num, name, sem, unique) {
|
|||||||
data: Object.values(gradeDist),
|
data: Object.values(gradeDist),
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
// borderColor: '#36A2EB',
|
// borderColor: '#36A2EB',
|
||||||
backgroundColor: ["rgb(98, 244, 54)", "rgb(129, 231, 10)", "rgb(151, 218, 0)", "rgb(168, 204, 0)", "rgb(181, 190, 0)", "rgb(191, 176, 0)", "rgb(199, 162, 0)", "rgb(205, 148, 0)", "rgb(209, 133, 0)", "rgb(211, 119, 0)", "rgb(210, 105, 0)", "rgb(208, 91, 23)", "rgb(204, 78, 36)", "rgb(198, 66, 46)", "rgb(190, 54, 54)", ""],
|
backgroundColor: backgroundColor,
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
gradeChart.update();
|
gradeChart.update();
|
||||||
@@ -176,7 +180,7 @@ function loadChart(gradeDist, courseName) {
|
|||||||
label: '\"' + courseName + "\"",
|
label: '\"' + courseName + "\"",
|
||||||
data: Object.values(gradeDist),
|
data: Object.values(gradeDist),
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
backgroundColor: ["rgb(98, 244, 54)", "rgb(129, 231, 10)", "rgb(151, 218, 0)", "rgb(168, 204, 0)", "rgb(181, 190, 0)", "rgb(191, 176, 0)", "rgb(199, 162, 0)", "rgb(205, 148, 0)", "rgb(209, 133, 0)", "rgb(211, 119, 0)", "rgb(210, 105, 0)", "rgb(208, 91, 23)", "rgb(204, 78, 36)", "rgb(198, 66, 46)", "rgb(190, 54, 54)", ""],
|
backgroundColor: backgroundColor,
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
Reference in New Issue
Block a user