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;
|
||||
const ctx = document.getElementById("gradeBar");
|
||||
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
|
||||
*/
|
||||
@@ -23,7 +23,9 @@ async function parseName() {
|
||||
if (!fiveDigit) {
|
||||
await fetch('https://derec4.github.io/ut-grade-data/2022prefixes.json')
|
||||
.then(res => res.json())
|
||||
.then(data => { departments = data; });
|
||||
.then(data => {
|
||||
departments = data;
|
||||
});
|
||||
if (!className && !classNum && !department) {
|
||||
alert("At least fill out the form...");
|
||||
return;
|
||||
@@ -81,7 +83,9 @@ async function PapaParse(department, num, name, sem, unique) {
|
||||
}
|
||||
await fetch(url)
|
||||
.then(res => res.json())
|
||||
.then(data => { cData = data; });
|
||||
.then(data => {
|
||||
cData = data;
|
||||
});
|
||||
let selectedClass = '';
|
||||
if (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),
|
||||
borderWidth: 2,
|
||||
// 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();
|
||||
@@ -176,7 +180,7 @@ function loadChart(gradeDist, courseName) {
|
||||
label: '\"' + courseName + "\"",
|
||||
data: Object.values(gradeDist),
|
||||
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: {
|
||||
|
||||
Reference in New Issue
Block a user