Skip to content

Commit

Permalink
Removed chart
Browse files Browse the repository at this point in the history
  • Loading branch information
clr-li committed Apr 5, 2024
1 parent d7f14dc commit 05cd5ba
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 69 deletions.
5 changes: 0 additions & 5 deletions public/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ <h1>Stats</h1>
<div class="scroll">
<table id="user-stats-table" class="calendar"></table>
</div><br>
<div style="display: flex; flex-wrap: wrap">
<div style="margin: auto; flex-grow: 1; max-width: var(--max-width); min-width: 30%; min-height: 100px;" class="load-wrapper">
<canvas id="member-chart" style="background-color: white; border: 2px black solid; padding: 5px; border-radius: 5px;"></canvas>
</div>
</div>
</section>
</navigation-manager>

Expand Down
65 changes: 1 addition & 64 deletions public/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { GET } from './util/Client.js';
import { initBusinessSelector } from './util/selectors.js';
import { calcSimilarity, sanitizeText } from '../util/util.js';
import { Popup } from './components/Popup.js';
const Chart = window.Chart;
await requireLogin();

const { get: getBusinessId } = await initBusinessSelector('business-selector', async () => {
Expand Down Expand Up @@ -68,7 +67,7 @@ async function runMemberStatsTable(memberAttArr, numPastEvents) {
}
const attendance = document.getElementById('user-stats-table');
attendance.innerHTML = html;
runMemberStatsChart(uidToUserinfo);

const presentButton = document.getElementById('sort-present');
const absentButton = document.getElementById('sort-absent');
const lateButton = document.getElementById('sort-late');
Expand Down Expand Up @@ -112,68 +111,6 @@ function sortStatus(statusBtn, otherBtn1, otherBtn2, otherBtn3, index) {
otherBtn3.innerHTML = '<i class="fa-solid fa-sort"></i>';
}

function runMemberStatsChart(uidToUserInfo) {
let xValues = [];
// get all present values for each user
let yPresent = [];
let yAbsent = [];
let yLate = [];
let yExcused = [];
for (const user of uidToUserInfo.keys()) {
const userinfo = uidToUserInfo.get(user);
yPresent.push(userinfo.PRESENT);
yAbsent.push(userinfo.ABSENT);
yLate.push(userinfo.LATE);
yExcused.push(userinfo.EXCUSED);
xValues.push(userinfo.name);
}

new Chart(document.getElementById('member-chart'), {
type: 'bar',
data: {
labels: xValues,
datasets: [
{
label: 'PRESENT',
data: yPresent,
borderWidth: 1,
},
{
label: 'ABSENT',
data: yAbsent,
borderWidth: 1,
},
{
label: 'LATE',
data: yLate,
borderWidth: 1,
},
{
label: 'EXCUSED',
data: yExcused,
borderWidth: 1,
},
],
},
options: {
plugins: {
title: {
display: true,
text: 'Member Attendance',
},
},
scales: {
x: {
stacked: true,
},
y: {
stacked: true,
},
},
},
});
}

function sortStudents(searchword) {
searchword = searchword.toLowerCase();
var table, rows, switching, i, x, y, shouldSwitch;
Expand Down

0 comments on commit 05cd5ba

Please sign in to comment.