Skip to content

Commit 96f72ff

Browse files
committed
Time Graph doesn't display on first load, edited size
1 parent 2eecce2 commit 96f72ff

File tree

3 files changed

+15
-30
lines changed

3 files changed

+15
-30
lines changed

src/App.svelte

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,13 @@
200200
201201
currentRegion.subscribe(r => {
202202
updateTimeSliceCache($currentSensor, $currentLevel, r);
203-
r ? toggleGraphShowStatus(null, true) : toggleGraphShowStatus(null, false);
203+
if (!$mounted) {
204+
toggleGraphShowStatus(null, false);
205+
} else if (r) {
206+
toggleGraphShowStatus(null, true);
207+
} else {
208+
toggleGraphShowStatus(null, false);
209+
}
204210
});
205211
206212
onMount(_ => {
@@ -301,6 +307,7 @@
301307
signalType,
302308
);
303309
}
310+
304311
// Keep the URL updated with the current state
305312
currentSensor.subscribe(s => updateURIParameters(s, $currentLevel, $currentRegion, $currentDate, $signalType));
306313
currentLevel.subscribe(l => updateURIParameters($currentSensor, l, $currentRegion, $currentDate, $signalType));
@@ -402,8 +409,8 @@
402409
}
403410
404411
.graph-toggle-button {
405-
width: 30px;
406-
height: 30px;
412+
width: 70px;
413+
height: 35px;
407414
cursor: pointer;
408415
background-color: transparent;
409416
padding: 0;
@@ -416,12 +423,6 @@
416423
background-color: #eee;
417424
}
418425
419-
img.toggle-button-icon {
420-
width: 24px;
421-
height: 24px;
422-
background: transparent;
423-
}
424-
425426
button.graph-toggle-button .button-tooltip {
426427
visibility: hidden;
427428
width: 120px;
@@ -512,7 +513,7 @@
512513
aria-label="show time series"
513514
on:click={event => toggleGraphShowStatus(false)}>
514515
<span class="button-tooltip">Show time series</span>
515-
<img class="toggle-button-icon" src="./assets/imgs/line-graph-icon.png" alt="" />
516+
<b>Time Graph</b>
516517
</button>
517518
</div>
518519
{/if}

src/Graph.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@
279279

280280
<style>
281281
.graph {
282-
max-height: 351px;
283-
max-width: 360px;
282+
max-height: 390px;
283+
max-width: 400px;
284284
}
285285
286286
.graph-title {

src/MapBox.svelte

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,6 @@
9797
if (sens.name === 'Deaths (JHU)') {
9898
const death_num = e.features[0].properties.value;
9999
const ratio = e.features[0].properties.value1;
100-
/*
101-
body = `
102-
<div class="map-popup-region-value-container">
103-
Population: ${Population} <br>
104-
Deaths : ${death_num} <br>
105-
${sens.yAxis}:
106-
<span class="map-popup-region-value"
107-
style="background-color: ${fillColor};
108-
color: ${getTextColorBasedOnBackground(fillColor)};">
109-
${value.toFixed(2)}
110-
${sens.format === 'percent' ? '%' : ''}
111-
</span>
112-
113-
</div>
114-
`;
115-
*/
116100
body = `
117101
<div class="map-popup-region-value-container">
118102
Population: ${Population} <br>
@@ -321,8 +305,8 @@
321305
if (geoIds.has(id + '000') && valueMappedMega.get(id) !== undefined) {
322306
d.properties.value = valueMappedMega.get(id)[0];
323307
if ($sensorMap.get($currentSensor).name === 'Deaths (JHU)') {
324-
d.properties.value = valueMappedVals.get(id)[1];
325-
d.properties.value1 = valueMappedVals.get(id)[0];
308+
d.properties.value = valueMappedMega.get(id)[1];
309+
d.properties.value1 = valueMappedMega.get(id)[0];
326310
}
327311
}
328312
if (geoIds.has(id + '000') && directionMappedMega.get(id) !== undefined) {

0 commit comments

Comments
 (0)