Skip to content

Commit 2eecce2

Browse files
committed
modified legend for deaths as well as changed color for 0 death count
1 parent b099553 commit 2eecce2

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/Legend.svelte

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@
1010
stats.subscribe(s => (s ? updateLowHigh($currentSensor, s) : ''));
1111
1212
function updateLowHigh(sens, stats) {
13-
let sts = stats.get(sens);
14-
let valueMinMax = [sts.mean - 3 * sts.std, sts.mean + 3 * sts.std];
13+
let sts;
14+
let valueMinMax;
15+
16+
if ($currentSensor === 'jhu-csse-deaths_incidence_prop') {
17+
sts = stats.get(sens + '_count');
18+
valueMinMax = [sts.low, sts.high];
19+
} else {
20+
sts = stats.get(sens);
21+
valueMinMax = [sts.mean - 3 * sts.std, sts.mean + 3 * sts.std];
22+
}
1523
1624
if ($sensorMap.get($currentSensor).format === 'raw') {
1725
high = valueMinMax[1].toFixed(2);

src/MapBox.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356
let center = valueMinMax[0] + (valueMinMax[1] - valueMinMax[0]) / 2;
357357
if ($sensorMap.get($currentSensor).name === 'Deaths (JHU)') {
358358
stops = [
359-
[0, MAP_THEME.countyFill],
359+
[0, DIRECTION_THEME.deathMin],
360360
[valueMinMax[0], DIRECTION_THEME.gradientMin],
361361
[center, DIRECTION_THEME.gradientMiddle],
362362
[valueMinMax[1], DIRECTION_THEME.gradientMax],
@@ -368,7 +368,6 @@
368368
];
369369
} else {
370370
stops = [
371-
[0, MAP_THEME.countyFill],
372371
[Math.max(0, valueMinMax[0]), DIRECTION_THEME.gradientMin],
373372
[center, DIRECTION_THEME.gradientMiddle],
374373
[valueMinMax[1], DIRECTION_THEME.gradientMax],

src/theme.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const DIRECTION_THEME = {
1414
steadyIcon: '▬',
1515
decreasingIcon: '▼',
1616
max: color_high,
17+
deathMin: '#F2F2F2',
1718
gradientMin: color_low,
1819
gradientMiddle: color_medium,
1920
gradientMax: color_high,
@@ -28,4 +29,4 @@ export const MAP_THEME = {
2829
stateOutline: '#bcbcbc',
2930
countyFill: '#e4dac4',
3031
countyOutline: '#e0e0e0',
31-
};
32+
};

0 commit comments

Comments
 (0)