Age/size legends

This commit is contained in:
Tom Russell 2018-08-09 15:59:56 +01:00
parent 17e77d118c
commit f9cf06e203
4 changed files with 273 additions and 15 deletions

View File

@ -64,13 +64,134 @@
<div id="legend" class="info-container offscreen">
<h2 class="h2">Maps</h2>
<ul class="maps-list">
<li class="bullet-prefix age" data-map="date_year">Year Built</li>
<li class="bullet-prefix size" data-map="size_storeys">Number of storeys</li>
<div class="data-section">
<h3 class="h3 bullet-prefix age">Age</h3>
<dl class="data-list">
<dt><a href="/maps/date_year" data-map="date_year">Year Built</a></dt>
<dd>
<ul class="data-legend">
<li>
<span class="key" style="background: #fcfcb8">-</span>
&gt;=2000
</li>
<li>
<span class="key" style="background: #fee9a5">-</span>
1980-2000
</li>
<li>
<span class="key" style="background: #fec580">-</span>
1960-1980
</li>
<li>
<span class="key" style="background: #ffb63c">-</span>
1940-1960
</li>
<li>
<span class="key" style="background: #ff7e3e">-</span>
1920-1940
</li>
<li>
<span class="key" style="background: #ff5353">-</span>
1900-1920
</li>
<li>
<span class="key" style="background: #df73ff">-</span>
1880-1900
</li>
<li>
<span class="key" style="background: #b81ae7">-</span>
1860-1880
</li>
<li>
<span class="key" style="background: #8400a8">-</span>
1840-1860
</li>
<li>
<span class="key" style="background: #73ffdf">-</span>
1820-1840
</li>
<li>
<span class="key" style="background: #00ffc5">-</span>
1800-1820
</li>
<li>
<span class="key" style="background: #00c5ff">-</span>
1780-1800
</li>
<li>
<span class="key" style="background: #73b2ff">-</span>
1760-1780
</li>
<li>
<span class="key" style="background: #00a9e6">-</span>
1740-1760
</li>
<li>
<span class="key" style="background: #0070ff">-</span>
1720-1740
</li>
<li>
<span class="key" style="background: #004da8">-</span>
1700-1720
</li>
<li>
<span class="key" style="background: #897044">-</span>
1680-1700
</li>
<li>
<span class="key" style="background: #894444">-</span>
1660-1680
</li>
<li>
<span class="key" style="background: #4c0073">-</span>
&lt;1660
</li>
</ul>
<h3 class="h3">Building</h3>
</dd>
</dl>
</div>
<div class="data-section">
<h3 class="h3 bullet-prefix size">Size</h3>
<dl class="data-list">
<dt><a href="/maps/size_storeys" data-map="size_storeys">Number of storeys</a></dt>
<dd>
<ul class="data-legend">
<li>
<span class="key" style="background: #ffc584">-</span>
&gt;20
</li>
<li>
<span class="key" style="background: #f46259">-</span>
10-20
</li>
<li>
<span class="key" style="background: #da456a">-</span>
5-10
</li>
<li>
<span class="key" style="background: #a8327d">-</span>
4
</li>
<li>
<span class="key" style="background: #7c2383">-</span>
3
</li>
<li>
<span class="key" style="background: #5b167f">-</span>
2
</li>
<li>
<span class="key" style="background: #360f69">-</span>
1
</li>
</ul>
</dd>
</dl>
</ul>
<h2 class="h2">Building</h2>
<pre id="building-detail">
Click a building to see data.
Click a building to see data.
</pre>
</div>
</main>

View File

@ -454,8 +454,6 @@ small {
background-color: #7d7d7d;
content: ' ';
}
.data-section {
}
.data-section .h3 {
margin: 0;
}
@ -463,6 +461,14 @@ small {
margin: 0.5rem 0 1rem;
padding-left: 1.5rem;
}
.data-list a {
color: #555;
}
.data-list a:focus,
.data-list a:active,
.data-list a:hover {
color: #222;
}
.data-list dt,
.data-section label {
margin: 0;
@ -479,6 +485,16 @@ small {
.data-list .no-data {
color: #999;
}
.data-legend {
list-style: none;
padding: 0;
}
.data-legend .key {
display: inline-block;
width: 10px;
height: 10px;
overflow: hidden;
}
/**
* Forms

View File

@ -56,7 +56,7 @@ function map(){
})
data_layers[name].setZIndex(10);
var el = document.querySelector('li[data-map="'+name+'"]')
var el = document.querySelector('a[data-map="'+name+'"]')
if (!el){
continue;
}
@ -84,7 +84,7 @@ function map(){
var lat = e.latlng.lat
var lng = e.latlng.lng
fetch(
'/api/buildings?lat='+lat+'&lng='+lng
'/api/buildings?lat='+lat+'&lng='+lng+'&field='+active_data_layer
).then(function(response){
return response.json()
}).then(function(data){
@ -101,7 +101,7 @@ function map(){
if (data.error){
preview_el.textContent = 'Click a building to see data';
} else {
preview_el.textContent = JSON.stringify(data, ["id", "date_year", "date_source", "size_storeys", "uprns"], 2);
preview_el.textContent = JSON.stringify(data, ["id", active_data_layer], 2);
}
})
})

View File

@ -58,11 +58,132 @@
<div id="map"></div>
<div id="legend" class="info-container">
<h2 class="h2">Maps</h2>
<ul class="maps-list">
<li class="bullet-prefix age" data-map="date_year">Year Built</li>
<li class="bullet-prefix size" data-map="size_storeys">Number of storeys</li>
<div class="data-section">
<h3 class="h3 bullet-prefix age">Age</h3>
<dl class="data-list">
<dt><a href="/maps/date_year" data-map="date_year">Year Built</a></dt>
<dd>
<ul class="data-legend">
<li>
<span class="key" style="background: #fcfcb8">-</span>
&gt;=2000
</li>
<li>
<span class="key" style="background: #fee9a5">-</span>
1980-2000
</li>
<li>
<span class="key" style="background: #fec580">-</span>
1960-1980
</li>
<li>
<span class="key" style="background: #ffb63c">-</span>
1940-1960
</li>
<li>
<span class="key" style="background: #ff7e3e">-</span>
1920-1940
</li>
<li>
<span class="key" style="background: #ff5353">-</span>
1900-1920
</li>
<li>
<span class="key" style="background: #df73ff">-</span>
1880-1900
</li>
<li>
<span class="key" style="background: #b81ae7">-</span>
1860-1880
</li>
<li>
<span class="key" style="background: #8400a8">-</span>
1840-1860
</li>
<li>
<span class="key" style="background: #73ffdf">-</span>
1820-1840
</li>
<li>
<span class="key" style="background: #00ffc5">-</span>
1800-1820
</li>
<li>
<span class="key" style="background: #00c5ff">-</span>
1780-1800
</li>
<li>
<span class="key" style="background: #73b2ff">-</span>
1760-1780
</li>
<li>
<span class="key" style="background: #00a9e6">-</span>
1740-1760
</li>
<li>
<span class="key" style="background: #0070ff">-</span>
1720-1740
</li>
<li>
<span class="key" style="background: #004da8">-</span>
1700-1720
</li>
<li>
<span class="key" style="background: #897044">-</span>
1680-1700
</li>
<li>
<span class="key" style="background: #894444">-</span>
1660-1680
</li>
<li>
<span class="key" style="background: #4c0073">-</span>
&lt;1660
</li>
</ul>
<h3 class="h3">Building</h3>
</dd>
</dl>
</div>
<div class="data-section">
<h3 class="h3 bullet-prefix size">Size</h3>
<dl class="data-list">
<dt><a href="/maps/size_storeys" data-map="size_storeys">Number of storeys</a></dt>
<dd>
<ul class="data-legend">
<li>
<span class="key" style="background: #ffc584">-</span>
&gt;20
</li>
<li>
<span class="key" style="background: #f46259">-</span>
10-20
</li>
<li>
<span class="key" style="background: #da456a">-</span>
5-10
</li>
<li>
<span class="key" style="background: #a8327d">-</span>
4
</li>
<li>
<span class="key" style="background: #7c2383">-</span>
3
</li>
<li>
<span class="key" style="background: #5b167f">-</span>
2
</li>
<li>
<span class="key" style="background: #360f69">-</span>
1
</li>
</ul>
</dd>
</dl>
</ul>
<h2 class="h2">Building</h2>
<pre id="building-detail">
Click a building to see data.
</pre>