Skip to content

Commit b54b9f6

Browse files
committed
Adjust SIMD legend into quintiles and tweak popup copy.
1 parent f4e55b5 commit b54b9f6

6 files changed

+61
-13
lines changed

web/src/AutoBoundariesMode.svelte

+4-2
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@
168168
<p>The colors are arbitrary, just to distinguish better.</p>
169169
{/if}
170170

171+
<hr />
172+
171173
<button class="secondary" on:click={download}>Export to GeoJSON</button>
172174

173175
<label>
@@ -199,8 +201,8 @@
199201
<b>Area:</b>
200202
{props.area_km2.toFixed(1)} km²
201203
{:else if selectedPrioritization == "simd"}
202-
<b>Fake SIMD:</b>
203-
{props.simd.toFixed(1)}
204+
<b>SIMD:</b>
205+
Less deprived than {props.simd.toFixed(1)}% of data zones.
204206
{:else if selectedPrioritization == "stats19"}
205207
<b>
206208
Density of pedestrian and cyclist collisions (collisions per

web/src/PickNeighbourhoodMode.svelte

+4-4
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@
244244
</span>
245245
{:else if selectedPrioritization == "simd"}
246246
<span>
247-
<b>SIMD (percentile):</b>
248-
{simd.toFixed(1)}
247+
<b>SIMD:</b>
248+
Less deprived than {simd.toFixed(1)}% of data zones.
249249
</span>
250250
{/if}
251251
</li>
@@ -323,8 +323,8 @@
323323
<b>Area:</b>
324324
{props.area_km2.toFixed(1)} km²
325325
{:else if selectedPrioritization == "simd"}
326-
<b>Fake SIMD:</b>
327-
{props.simd.toFixed(1)}
326+
<b>SIMD:</b>
327+
Less deprived than {props.simd.toFixed(1)}% of data zones.
328328
{:else if selectedPrioritization == "stats19"}
329329
<b>
330330
Density of pedestrian and cyclist collisions (collisions per
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script>
2+
export let colorScale;
3+
export let buckets;
4+
export let decimalPlaces = 0;
5+
</script>
6+
7+
<div style="display: flex">
8+
{#each colorScale as color}
9+
<span style="background: {color}; width: 100%; border: 1px solid black;">
10+
&nbsp;
11+
</span>
12+
{/each}
13+
</div>
14+
<div style="display: flex; justify-content: space-around;">
15+
{#each buckets as bucket}
16+
{#if decimalPlaces > 0}
17+
<span>{bucket.toFixed(decimalPlaces)}</span>
18+
{:else}
19+
<span>{bucket}</span>
20+
{/if}
21+
{/each}
22+
</div>

web/src/common/colors.ts

+8
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,11 @@ export let areaLimits = [0.0, 0.3, 0.6, 1.0, 1.5, 2.0];
4141

4242
export let stats19Limits = [0, 1.0, 10.0, 50.0, 100.0, 1000.0];
4343
export let stats19ColorScale = demandColorScale;
44+
45+
export function bucketize(limits: number[]) {
46+
let buckets = [];
47+
for (let i = 1; i <= limits.length; i++) {
48+
buckets.push(i);
49+
}
50+
return buckets;
51+
}

web/src/context/Population.svelte

+12-5
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
import { SequentialLegend } from "svelte-utils";
99
import { makeRamp, Popup } from "svelte-utils/map";
1010
import { layerId } from "../common";
11-
import { simdColorScale, simdLimits } from "../common/colors";
11+
import { bucketize, simdColorScale, simdLimits } from "../common/colors";
1212
import ContextLayerButton from "../common/ContextLayerButton.svelte";
13+
import SequentialLegendBucketed from "../common/SequentialLegendBucketed.svelte";
1314
import { assetUrl } from "../stores";
1415
1516
let showSIMD = false;
@@ -22,8 +23,14 @@
2223

2324
<ContextLayerButton label="SIMD" bind:show={showSIMD}>
2425
<div slot="legend">
25-
<SequentialLegend colorScale={simdColorScale} limits={simdLimits} />
26-
<p>Darker colours are more deprived</p>
26+
<SequentialLegendBucketed
27+
colorScale={simdColorScale}
28+
buckets={bucketize(simdLimits)}
29+
/>
30+
<div style="display: flex; justify-content: space-between;">
31+
<span>More deprived</span>
32+
<span>Less deprived</span>
33+
</div>
2734
</div>
2835

2936
<p slot="help">
@@ -78,8 +85,8 @@
7885
<p>
7986
Data zone {props.id}
8087
has {props.population.toLocaleString()}
81-
people, and a SIMD rank of {props.imd_rank}, putting it in the {props.imd_percentile}
82-
percentile.
88+
people, and a SIMD rank of {props.imd_rank}, making it less deprived
89+
than {props.imd_percentile}% of data zones.
8390
</p>
8491
</Popup>
8592
</FillLayer>

web/src/prioritization/PrioritizationSelect.svelte

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
import { SequentialLegend } from "svelte-utils";
33
import {
44
areaLimits,
5+
bucketize,
56
simdColorScale,
67
simdLimits,
78
stats19ColorScale,
89
stats19Limits,
910
} from "../common/colors";
11+
import SequentialLegendBucketed from "../common/SequentialLegendBucketed.svelte";
1012
import { projectName } from "../stores";
1113
import type { Prioritization } from "./index";
1214
@@ -47,13 +49,20 @@
4749
<select id="prioritization-selection" bind:value={selectedPrioritization}>
4850
<option value="none">None</option>
4951
<option value="area">Area (km²)</option>
50-
<option value="simd">Fake SIMD (percentile)</option>
52+
<option value="simd">SIMD</option>
5153
<option value="stats19">Collisions</option>
5254
</select>
5355
</div>
5456

5557
{#if selectedPrioritization == "simd"}
56-
<SequentialLegend colorScale={simdColorScale} limits={simdLimits} />
58+
<SequentialLegendBucketed
59+
colorScale={simdColorScale}
60+
buckets={bucketize(simdLimits)}
61+
/>
62+
<div style="display: flex; justify-content: space-between;">
63+
<span>More deprived</span>
64+
<span>Less deprived</span>
65+
</div>
5766
{:else if selectedPrioritization == "area"}
5867
<SequentialLegend colorScale={simdColorScale} limits={areaLimits} />
5968
{:else if selectedPrioritization == "stats19"}

0 commit comments

Comments
 (0)