add simple legend with colors

This commit is contained in:
Jakob Ketterl
2019-07-28 15:57:33 +02:00
parent 6e7d99376d
commit 74dddcb8ad
3 changed files with 28 additions and 1 deletions

View File

@ -44,6 +44,7 @@
colorKeys[key] = colors[index];
});
reColor();
updateLegend();
}
return colorKeys[id];
}
@ -59,6 +60,13 @@
});
}
var updateLegend = function() {
var lis = $.map(colorKeys, function(value, key) {
return '<li class="square"><span class="illustration" style="background-color:' + value + ';"></span>' + key + '</li>';
});
$(".openwebrx-map-legend .content").html('<ul>' + lis.join('') + '</ul>');
}
var processUpdates = function(updates) {
if (!map) {
updateQueue = updateQueue.concat(updates);
@ -183,6 +191,7 @@
nite.init(map);
setInterval(function() { nite.refresh() }, 10000); // every 10s
});
map.controls[google.maps.ControlPosition.LEFT_BOTTOM].push($(".openwebrx-map-legend")[0]);
});
retention_time = config.map_position_retention_time * 1000;
break;