Skip to content

Commit 1c7cf98

Browse files
committed
Adding more colour palette options for maps
1 parent fb8e23f commit 1c7cf98

File tree

3 files changed

+1573
-4
lines changed

3 files changed

+1573
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
ControlButton,
1212
ControlGroup,
1313
} from "svelte-maplibre";
14-
import { contrastingColor, colorPalette } from "./colors.ts";
14+
import { contrastingColor } from "./colors.ts";
15+
import { colorbrewer } from "./colorbrewer.js";
1516
import { hoverStateFilter } from "svelte-maplibre/filters.js";
1617
import type { maplibregl, ExpressionSpecification } from "maplibre-gl";
1718
import fullTopo from "./fullTopo.json";
@@ -38,6 +39,7 @@
3839
scaleControl,
3940
scaleControlPosition = "bottom-left",
4041
scaleControlUnit = "metric",
42+
colorPalette = "YlGnBu",
4143
showBorder = false,
4244
maxBorderWidth = 1.5,
4345
tooltip,
@@ -53,7 +55,7 @@
5355
center = [-2.5, 53],
5456
zoom = 5,
5557
} = $props();
56-
$inspect(navigationControlPosition);
58+
5759
let mapData = $derived(data?.filter((d) => d.year == year)[0]?.data);
5860
5961
let filteredMapData = $derived(
@@ -70,8 +72,8 @@
7072
7173
let filteredGeoJsonData = $derived(filterGeo(geojsonData, year));
7274
73-
let fillColor = $derived(colorPalette[numberOfBreaks]);
74-
$inspect(fillColor);
75+
let fillColor = $derived(colorbrewer[colorPalette][numberOfBreaks]);
76+
7577
let borderColor = "#003300";
7678
7779
let map: maplibregl.Map | undefined = $state();

0 commit comments

Comments
 (0)