Skip to content

Commit

Permalink
code clean - removed unecessary parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
anandhu-eng committed Sep 2, 2024
1 parent aa570f3 commit 58e7664
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
18 changes: 6 additions & 12 deletions javascripts/results_charts.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
function reConstructAccvsPerfChart(category, division, with_power, data) {
function reConstructAccvsPerfChart(category) {
availabilities = [ "Available", "Preview", "RDI" ];
availabilities.forEach(function(availability) {
// filtered data as per the user choice
//console.log(filteredResults.length);
constructAccvsPerfChart(category, division, with_power, availability);
drawAccvsPerfPlot(category, availability);
});
}

function constructAccvsPerfChart(category, division, with_power, availability) {
if(division == "open") {
drawAccvsPerfPlot(category, division, with_power, availability);
}
}

function drawAccvsPerfPlot(category, division, with_power, availability) {
function drawAccvsPerfPlot(category, availability) {
// the data here is the preprocessed data through function preprocessData
models = []
if (category == "datacenter") {
Expand All @@ -28,9 +22,9 @@ function drawAccvsPerfPlot(category, division, with_power, availability) {
if (accuracyUnits.hasOwnProperty(model)) {
accuracyMetric = accuracyUnits[model].split(",")[0].trim();
}
if (category === "datacenter" && division === "open") {
if (category === "datacenter") {
let extractedData = extractTableDataForAccVsPerf(model, availability);
const chartContainer = document.getElementById(`AccVsPerfScatterPlot_${model}_${division}_${category}_${availability}`);
const chartContainer = document.getElementById(`AccVsPerfScatterPlot_${model}_open_${category}_${availability}`);
if (extractedData.length === 0) {
if (chartContainer) {
chartContainer.style.display = 'none'; // hide the div
Expand All @@ -42,7 +36,7 @@ function drawAccvsPerfPlot(category, division, with_power, availability) {
}
// let filteredData = filterForAccvsPerfPlot(data, model, category, division, accuracyMetric);
if (extractedData.length !== 0) {
let chart = new CanvasJS.Chart(`AccVsPerfScatterPlot_${model}_${division}_${category}_${availability}`, {
let chart = new CanvasJS.Chart(`AccVsPerfScatterPlot_${model}_open_${category}_${availability}`, {
animationEnabled: true,
theme: "light2",
title:{
Expand Down
12 changes: 7 additions & 5 deletions javascripts/results_tablesorter.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ $(document).ready(function() {
readAllData().then(function(allData) {
// console.log(allData);
reConstructTables(category, division, with_power[0], allData);
reConstructAccvsPerfChart(category, division, with_power[0], allData);
if (division === "open") {
reConstructAccvsPerfChart(category);
}
constructChartFromSummary(allData, category, division, with_power[0]);
}).catch(function(error) {
console.error(error);
Expand Down Expand Up @@ -573,7 +575,7 @@ function constructOpenTableModel(model, category, with_power, availability, myda
//console.log(html);
return html;
}
function constructOpenTable(category, division, with_power, availability, data) {
function constructOpenTable(category, with_power, availability, data) {
models = []
if (category == "datacenter") {
models = models_datacenter;
Expand All @@ -584,9 +586,9 @@ function constructOpenTable(category, division, with_power, availability, data)
html = ''
models.forEach(function(model, index) {
html += constructOpenTableModel(model, category, with_power, availability, data);
if (category === "datacenter" && division === "open") {
if (category === "datacenter") {
html += `
<div id="AccVsPerfScatterPlot_${model}_${division}_${category}_${availability}" style="height: 370px; width: 100%; display: none; "></div>
<div id="AccVsPerfScatterPlot_${model}_open_${category}_${availability}" style="height: 370px; width: 100%; display: none; "></div>
`;
}
});
Expand All @@ -609,7 +611,7 @@ function constructTable(category, division, with_power, availability, data) {
}
var needsFooter = Object.keys(mydata).length > 5;
if(division == "open") {
html = constructOpenTable(category, division, with_power, availability, mydata);
html = constructOpenTable(category, with_power, availability, mydata);
//console.log(html);
return html;
}
Expand Down

0 comments on commit 58e7664

Please sign in to comment.