Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.139.235.100
function getData() {
let url = document.URL;
urlParams = parseURLParams(url);
console.log(urlParams);
$.ajax({
type: "GET",
url:
"https://college.universitysolutions.in/app.php?db=" +
urlParams.db[0] +
"&a=degwiseGrafAnalysisPie" +
"°grp=" +
urlParams.deggrp[0] +
"°exam=" +
urlParams.degexam[0] +
"&yearmode=" +
urlParams.yearmode[0],
success: function (res) {
let response = JSON.parse(res);
console.log(response);
if (response.data.data.length > 0) {
google.charts.load("current", { packages: ["corechart"] });
google.charts.setOnLoadCallback(drawChart);
// return;
let headings = document.createElement("div");
let colldet = document.createElement("div");
headings.appendChild(colldet);
if (urlParams.db[0] === "jssstu") {
let heading_1 = document.createElement("h3");
heading_1.style.cssText = "text-align: center;";
var t = document.createTextNode("JSS MAHAVIDYAPEETHA");
heading_1.appendChild(t);
colldet.appendChild(heading_1);
}
let heading_2 = document.createElement("h2");
var t2 = document.createTextNode(response.data.col_det.FUNIVNAME);
heading_2.appendChild(t2);
let heading_3 = document.createElement("h4");
var t3 = document.createTextNode(response.data.col_det.state);
heading_3.appendChild(t3);
let heading_4 = document.createElement("h3");
var t4 = document.createTextNode(
"College: " + response.data.obj.college_name
);
heading_4.appendChild(t4);
let heading_5 = document.createElement("h3");
var t5 = document.createTextNode(
"DEGREE GROUPWISE RESULT ANALYSIS - " +
response.data.data[0].fdeggrp.toUpperCase() +
" (" +
response.data.obj.fresexamdate +
") "
);
heading_5.appendChild(t5);
colldet.appendChild(heading_2);
colldet.appendChild(heading_3);
colldet.appendChild(heading_4);
colldet.appendChild(heading_5);
document.getElementById("piechart").appendChild(headings);
function drawChart() {
var data = google.visualization.arrayToDataTable([
["Degree Group", "Count"],
["S", parseInt(response.data.data[0].fs)],
["A", parseInt(response.data.data[0].fa)],
["B", parseInt(response.data.data[0].fb)],
["C", parseInt(response.data.data[0].fc)],
["D", parseInt(response.data.data[0].fd)],
["E", parseInt(response.data.data[0].fe)],
["F", parseInt(response.data.data[0].ffail)],
["AB", parseInt(response.data.data[0].fab)],
["NE", parseInt(response.data.data[0].fne)],
["Others", parseInt(response.data.data[0].fmp)],
["FAIL", parseInt(response.data.data[0].ffail)],
["PASS", parseInt(response.data.data[0].fpass)],
]);
var options = {
title: "Degree Group: " + response.data.data[0].fdeggrp,
pieSliceText: "label",
legend: {
position: "labeled",
textStyle: { color: "blue", fontSize: 10 },
},
width: "1200",
height: "800",
};
const div = document.createElement(`div`);
var chart = new google.visualization.PieChart(
document.getElementById("piechart").appendChild(div)
);
chart.draw(data, options);
let mainHeader = ["Total Records", "No. of Records Awarded"];
let subHeader = [
"Count",
"S",
"A",
"B",
"C",
"D",
"E",
"F",
"AB",
"NE",
"Others",
"Fail",
"PP",
];
let records = [
parseInt(response.data.data[0].COUNT),
parseInt(response.data.data[0].fs),
parseInt(response.data.data[0].fa),
parseInt(response.data.data[0].fb),
parseInt(response.data.data[0].fc),
parseInt(response.data.data[0].fd),
parseInt(response.data.data[0].fe),
parseInt(response.data.data[0].ffail),
parseInt(response.data.data[0].fab),
parseInt(response.data.data[0].fne),
parseInt(response.data.data[0].fmp),
parseInt(response.data.data[0].ffail),
parseInt(response.data.data[0].fpass),
];
let tableDiv = document.createElement("div");
tableDiv.setAttribute("class", "table-reponsive");
let table = document.createElement("table");
table.setAttribute("class", "table table-bordered");
let thead = document.createElement("thead");
let theadRow1 = document.createElement("tr");
thead.appendChild(theadRow1);
for (var k = 0; k < mainHeader.length; k++) {
let th = document.createElement("th");
if (k === 1) {
th.colSpan = 12;
}
th.appendChild(document.createTextNode(mainHeader[k]));
theadRow1.appendChild(th);
}
let theadRow2 = document.createElement("tr");
for (var k = 0; k < subHeader.length; k++) {
let th = document.createElement("th");
th.appendChild(document.createTextNode(subHeader[k]));
theadRow2.appendChild(th);
}
thead.appendChild(theadRow2);
table.appendChild(thead);
let tbody = document.createElement("tbody");
table.appendChild(tbody);
let tbodyRow = document.createElement("tr");
tbody.appendChild(tbodyRow);
for (i = 0; i < records.length; i++) {
let td = document.createElement("td");
td.appendChild(document.createTextNode(records[i]));
tbodyRow.appendChild(td);
}
let tbodyRow2 = document.createElement("tr");
tbody.appendChild(tbodyRow2);
for (i = 0; i < records.length; i++) {
let td = document.createElement("td");
if (i !== 0) {
td.appendChild(
document.createTextNode(
(
(records[i] / parseInt(response.data.data[0].COUNT)) *
100
).toFixed(2) + "%"
)
);
}
tbodyRow2.appendChild(td);
}
tableDiv.appendChild(table);
document.getElementById("piechart").appendChild(tableDiv);
}
} else {
alert("no data found");
return;
}
},
});
}
function parseURLParams(url) {
var queryStart = url.indexOf("?") + 1,
queryEnd = url.indexOf("#") + 1 || url.length + 1,
query = url.slice(queryStart, queryEnd - 1),
pairs = query.replace(/\+/g, " ").split("&"),
parms = {},
i,
n,
v,
nv;
if (query === url || query === "") return;
for (i = 0; i < pairs.length; i++) {
nv = pairs[i].split("=", 2);
n = decodeURIComponent(nv[0]);
v = decodeURIComponent(nv[1]);
if (!parms.hasOwnProperty(n)) parms[n] = [];
parms[n].push(nv.length === 2 ? v : null);
}
return parms;
}
|