Skip to content

Commit b6e1e83

Browse files
committed
Added ability to turn off the map ledgend
1 parent a2fd98c commit b6e1e83

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/lib/components/data-vis/map/Map.svelte

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
onstyleload,
9797
onstyledata,
9898
onidle,
99+
showLegend = false,
99100
}: {
100101
data: object[];
101102
customPalette?: object[];
@@ -486,15 +487,16 @@
486487
{/if}
487488
</MapLibre>
488489
</div>
489-
490-
<div class="legend">
491-
{#each legendItems as item}
492-
<div class="legend-item">
493-
<div class="legend-color" style="background-color: {item.color};"></div>
494-
<span>{item.label}</span>
495-
</div>
496-
{/each}
497-
</div>
490+
{#if showLegend}
491+
<div class="legend">
492+
{#each legendItems as item}
493+
<div class="legend-item">
494+
<div class="legend-color" style="background-color: {item.color};"></div>
495+
<span>{item.label}</span>
496+
</div>
497+
{/each}
498+
</div>
499+
{/if}
498500

499501
<style>
500502
:global(.maplibregl-ctrl-group button.reset-button) {

src/wrappers/components/data-vis/map/MapWrapper.svelte

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,13 @@
295295
value: 400,
296296
description: "Set height of map",
297297
},
298+
{
299+
name: "showLegend",
300+
category: "Styling",
301+
isProp: true,
302+
value: true,
303+
description:"Show the map Legend"
304+
}
298305
{
299306
name: "styleSheet",
300307
isProp: true,

0 commit comments

Comments
 (0)