Commit 72e0cf42 authored by Moreau Nicolas's avatar Moreau Nicolas
Browse files

correction for incorrect summed graph title calculation

parent f2c414d8
......@@ -238,3 +238,19 @@ function EXIT() {
}
console.log(result + ": exiting");
}
/**
Returns the index of the closest element in the array
for tyhe given value or null if not found
*/
function getIndex(array, value){
for(let i = 0; i < array.length; i++){
if(value >= array[i] && value < array[i+1]){
if(Math.abs(array[i+1]-value) > Math.abs(array[i]-value))
return i;
else
return i+1;
}
}
return null;
}
\ No newline at end of file
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment