-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust SIMD legend into quintiles and tweak copy #186
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script> | ||
export let colorScale; | ||
export let buckets; | ||
export let decimalPlaces = 0; | ||
</script> | ||
|
||
<div style="display: flex"> | ||
{#each colorScale as color} | ||
<span style="background: {color}; width: 100%; border: 1px solid black;"> | ||
| ||
</span> | ||
{/each} | ||
</div> | ||
<div style="display: flex; justify-content: space-around;"> | ||
{#each buckets as bucket} | ||
{#if decimalPlaces > 0} | ||
<span>{bucket.toFixed(decimalPlaces)}</span> | ||
{:else} | ||
<span>{bucket}</span> | ||
{/if} | ||
{/each} | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,9 @@ | |
import { SequentialLegend } from "svelte-utils"; | ||
import { makeRamp, Popup } from "svelte-utils/map"; | ||
import { layerId } from "../common"; | ||
import { simdColorScale, simdLimits } from "../common/colors"; | ||
import { bucketize, simdColorScale, simdLimits } from "../common/colors"; | ||
import ContextLayerButton from "../common/ContextLayerButton.svelte"; | ||
import SequentialLegendBucketed from "../common/SequentialLegendBucketed.svelte"; | ||
import { assetUrl } from "../stores"; | ||
|
||
let showSIMD = false; | ||
|
@@ -22,8 +23,14 @@ | |
|
||
<ContextLayerButton label="SIMD" bind:show={showSIMD}> | ||
<div slot="legend"> | ||
<SequentialLegend colorScale={simdColorScale} limits={simdLimits} /> | ||
<p>Darker colours are more deprived</p> | ||
<SequentialLegendBucketed | ||
colorScale={simdColorScale} | ||
buckets={bucketize(simdLimits)} | ||
/> | ||
<div style="display: flex; justify-content: space-between;"> | ||
<span>More deprived</span> | ||
<span>Less deprived</span> | ||
</div> | ||
</div> | ||
|
||
<p slot="help"> | ||
|
@@ -78,8 +85,8 @@ | |
<p> | ||
Data zone {props.id} | ||
has {props.population.toLocaleString()} | ||
people, and a SIMD rank of {props.imd_rank}, putting it in the {props.imd_percentile} | ||
percentile. | ||
people, and a SIMD rank of {props.imd_rank}, making it less deprived | ||
than {props.imd_percentile}% of data zones. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I felt that "putting it in the 15th percentile" was ambiguous (is that good or bad?) if you aren't already familiar with SIMD ranking conventions. Plus we're no longer showing percentile in the legend as a reference for these units. "less deprived than 15%" is kind of a weird way to phrase it, but it at least explains that a higher number is better. Personally, I think "more deprived than 70%" might be more natural to read, but I didn't want to invert the metric, since some people might already be familiar with the concept of SIMD percentiles. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This reads fine to me. We could ask if "more deprived" would be preferable/easier to read. |
||
</p> | ||
</Popup> | ||
</FillLayer> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fork of SequentialLegend from svelte-utils, but the labels fall on the buckets rather than between the buckets (consequently, there's one less label).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I might upstream this and use in NPW too.
Missing TS types, but I'll add them after merging the PR stacks to avoid any rebase headache.