Commit 5cb56085 authored by VANDAELE Julien's avatar VANDAELE Julien
Browse files

correct map drawing bug

AJAX asynchronous request was not well managed.
Needed to extract the drawing things into a callback function.
parent 180a790d
......@@ -105,23 +105,25 @@ window.onload = function() {
var radius = Math.max(Math.floor(height/testbedheight),Math.floor(width/testbedwidth))*11;
var generate = function() {
function generate() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
measures = JSON.parse(xhttp.responseText);
populateMap(measures);
}
};
var path = "measure";
var teamSelector = $("teamSelector").value;
console.log(path);
console.log(teamSelector);
if ( teamSelector !== undefined && teamSelector !== "undefined" && teamSelector !== "" ){
path = path + "?team=" + teamSelector;
}
console.log("path: ",path);
xhttp.open("GET", path, true);
xhttp.send();
}
function populateMap(measures) {
var max = maxLuminosityValue;
var min = 0
var t = [];
......@@ -133,7 +135,7 @@ window.onload = function() {
var value = measure.value;
t.push({ x: Math.floor(x*width/testbedwidth), y: Math.floor(y*height/testbedheight), value: value, radius: radius });
}
console.log(t);
console.log("data table: ",t);
var init = +new Date;
// set the generated dataset
......
Markdown is supported
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