From 3d1b35b068bb47a93073ec7feda2e3b8a26db73d Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 19 Jun 2023 11:03:29 +0200 Subject: [PATCH] [Gridmap] Added legend for totals --- application/views/gridmap/index.php | 28 ++++++++++++++++++++++++++++ assets/js/sections/gridmap.js | 15 +++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/application/views/gridmap/index.php b/application/views/gridmap/index.php index 264c4c6d..534680ea 100644 --- a/application/views/gridmap/index.php +++ b/application/views/gridmap/index.php @@ -1,3 +1,31 @@ +

diff --git a/assets/js/sections/gridmap.js b/assets/js/sections/gridmap.js index d11df9fe..74986cb9 100644 --- a/assets/js/sections/gridmap.js +++ b/assets/js/sections/gridmap.js @@ -59,6 +59,21 @@ function gridPlot(form) { exportOnly: true, hideControlContainer: true }).addTo(map); + + /*Legend specific*/ + var legend = L.control({ position: "topright" }); + + legend.onAdd = function(map) { + var div = L.DomUtil.create("div", "legend"); + div.innerHTML += "

Gridsquares

"; + div.innerHTML += 'Gridsquares confirmed ('+grid_four_confirmed.length+')
'; + div.innerHTML += 'Gridsquares not confirmed ('+(grid_four.length - grid_four_confirmed.length)+')
'; + div.innerHTML += 'Total gridsquares worked ('+grid_four.length+')
'; + return div; + }; + + legend.addTo(map); + var maidenhead = L.maidenhead().addTo(map); }, error: function (data) {