diff --git a/.~lock.day.csv# b/.~lock.day.csv# new file mode 100644 index 0000000..10d6cd7 --- /dev/null +++ b/.~lock.day.csv# @@ -0,0 +1 @@ +,reynaldo,reynaldo-desktop,12.01.2017 23:05,file:///home/reynaldo/.config/libreoffice/4; \ No newline at end of file diff --git a/MapScript.js b/MapScript.js index f33d0c8..77c8ca7 100644 --- a/MapScript.js +++ b/MapScript.js @@ -16,7 +16,7 @@ function initMap() { function classify(fileData) { var classSet = new Set(); classArr = []; - for(var i=0; i < fileData.data.length; i++) { + for(var i=0; i < fileData.data.length-1; i++) { classSet.add(fileData.data[i].class); } for (let item of classSet.values()) { @@ -55,9 +55,18 @@ function randomizeColors() { function addLegend(colors) { document.getElementById("legend-heading").innerHTML = "Legend:" + "
"; for (var i = 0; i < classArr.length; i++) { + // Create a container for the image and text + var row = document.createElement("div"); + // Add image to container var img = document.createElement('img'); img.src = "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + colors[i]; - document.getElementById("legend-content").innerHTML += img + ":" + classArr[i] + "
"; + row.appendChild(img); + // Add text to container + var row_text = document.createElement('span'); // NOTE: Span allows you to add in line elements! + row_text.innerHTML = ": " + classArr[i] + '
'; + row.appendChild(row_text); + // Add container to legend + document.getElementById("legend-content").appendChild(row); }; } @@ -66,12 +75,12 @@ function updateMapCenter(fileData) { var centerLon = 0; var centerLatTotal = 0; var centerLonTotal = 0; - for(var i=0; i