Prevent double display of org in line chart

pull/3/head
Sami Mokaddem 2017-11-10 09:22:46 +01:00
parent b0a83a9ebd
commit cb53be4253
1 changed files with 24 additions and 14 deletions

View File

@ -446,7 +446,16 @@ function updateProgressHeader(org) {
//update overtake points //update overtake points
updateOvertakePnts(); updateOvertakePnts();
//Add new data to linechart //Add new data to linechart
var flag_already_displayed = false;
for(obj of dataTop5Overtime) { //check if already displayed
if (obj.label == currOrg) {
flag_already_displayed = true;
break;
}
}
if (!flag_already_displayed) {
$.getJSON( url_getOrgOvertime+'?org='+org, function( data ) { $.getJSON( url_getOrgOvertime+'?org='+org, function( data ) {
var toPlot = dataTop5Overtime.slice(0); //cloning data var toPlot = dataTop5Overtime.slice(0); //cloning data
// transform secs into date // transform secs into date
@ -462,6 +471,7 @@ function updateProgressHeader(org) {
plotLineChart.draw(); plotLineChart.draw();
}); });
} }
}
function showOnlyOrg() { function showOnlyOrg() {
datatableCateg.search( $('#orgText').text() ).draw(); datatableCateg.search( $('#orgText').text() ).draw();