Skip to content

Commit 5110411

Browse files
committed
update activity
1 parent 56703ff commit 5110411

File tree

5 files changed

+94
-0
lines changed

5 files changed

+94
-0
lines changed

activity_03-01.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,97 @@ Click **Save**
200200
<img src="https://maptastik.github.com/os-webmap-workshop/images/tm-map10.png" width=100% />
201201

202202
#### Adding Interactivity
203+
204+
TileMill allows you to add some limited interactivity to you map. Primarily this means you can create info windows with additional information pulled form your data. For our map, we'll add an info window that tells the user the total and percentage of the population that is Hungarian descended as well as the census tract number.
205+
206+
On the vertical stack of buttons in the bottom-left corner, click the pointing hand. This will open up the *Templates* window. Here you have options to add a legend, hover teaser, click function, and link to external resources. Go ahead and click **Teaser**.
207+
208+
<img src="https://maptastik.github.com/os-webmap-workshop/images/tm-tease1.png" width=100% />
209+
210+
There is a dropdown menu currently set at `--disabled--`. This dropdown lets us determine what layer we're going to call on for interaction. Select `tracts`. You'll see the gray are abelow filled with the various attributes of from our tracts data surrounded by triple curly braces (Mustache tags).
211+
212+
<img src="https://maptastik.github.com/os-webmap-workshop/images/tm-tease1.png" width=100% />
213+
214+
In the content area above we can combine plain text or HTML with our mustachioed attributes. Let's use `{{{p_hung}}}`, `{{{t_hung}}}`, and `{{{NAME}}}` along with some HTML:
215+
216+
`There are <strong>{{{t_hung}}}</strong> residents (<strong>{{{p_hung}}}%</strong> of population) in tract <strong>{{{NAME}}}</strong> of Lucas County claiming Hungarian ancestry.`
217+
218+
Click on the **Full** button and the same text to that content area. By adding this text in both **Teaser** and **Full** we can see our info window text when we hover or click a feature.
219+
220+
Click **Save**.
221+
222+
<img src="https://maptastik.github.com/os-webmap-workshop/images/tm-map11.png" width=100% />
223+
224+
#### Add legend
225+
226+
You can create a legend using HTML. Open up the *Templates* window and select **Legend** and add the following HTML:
227+
228+
229+
`<div class='my-legend'>`
230+
231+
`<div class='legend-title'>Hungarian Ancestry in Lucas County, OH (by census tract)</div>`
232+
233+
`<div class='legend-scale'>`
234+
<br>
235+
`<!--You can adjust background:rgba(...) and the values between </span> &amp; </li> to reflect your color and classification schemes-->`
236+
<br>
237+
`<ul class='legend-labels'>`
238+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`<li><span style='background:rgba(255,255,204,0.5);'></span><1%</li>`
239+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`<li><span style='background:rgba(194,230,153,0.5);'></span>1% - 3.9%</li>`
240+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`<li><span style='background:rgba(120,198,121,0.5);'></span>4% - 6.9%</li>`
241+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`<li><span style='background:rgba(49,163,84,0.5);'></span>7% - 9.9%</li>`
242+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`<li><span style='background:rgba(0,104,55,0.5);'></span>>= 10%</li>`
243+
<br>`</ul>`
244+
<br>`</div>`
245+
<br>
246+
`<!--You can change the text between the various tags to reflect and link to your data source-->`
247+
<br>`<div class='legend-source'>Source: <a href="#link to source">ACS 2012 5yr</a></div>`
248+
<br>`</div>`
249+
<br>
250+
<br>
251+
`<!--This the general styling info for your legend. You can change any of this to suit your needs-->`
252+
<br>
253+
`<style type='text/css'>`
254+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`.my-legend .legend-title {
255+
text-align: left;
256+
margin-bottom: 8px;
257+
font-weight: bold;
258+
font-size: 90%;
259+
}`
260+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`.my-legend .legend-scale ul {
261+
margin: 0;
262+
padding: 0;
263+
float: left;
264+
list-style: none;
265+
}`
266+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`.my-legend .legend-scale ul li {
267+
display: block;
268+
float: left;
269+
width: 50px;
270+
margin-bottom: 6px;
271+
text-align: center;
272+
font-size: 80%;
273+
list-style: none;
274+
}`
275+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`.my-legend ul.legend-labels li span {
276+
display: block;
277+
float: left;
278+
height: 15px;
279+
width: 50px;
280+
}`
281+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`.my-legend .legend-source {
282+
font-size: 70%;
283+
color: #999;
284+
clear: both;
285+
}`
286+
<br>&nbsp;&nbsp;&nbsp;&nbsp;`.my-legend a {
287+
color: #777;
288+
}`
289+
<br>`</style>`
290+
291+
Click **Save**.
292+
293+
You have completed styling the map in TileMill!
294+
295+
<img src="https://maptastik.github.com/os-webmap-workshop/images/tm-map10.png" width=100% />
296+

images/tm-map11.png

28.1 KB
Loading

images/tm-map12.png

34.5 KB
Loading

images/tp-tease1.png

20.1 KB
Loading

images/tp-tease2.png

8.86 KB
Loading

0 commit comments

Comments
 (0)