|
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | 5 | "execution_count": null, |
6 | | - "metadata": { |
7 | | - "scrolled": false |
8 | | - }, |
| 6 | + "metadata": {}, |
9 | 7 | "outputs": [], |
10 | 8 | "source": [ |
11 | 9 | "from ipyleaflet import Map, GeoData, basemaps, LayersControl\n", |
|
37 | 35 | "from ipyleaflet import WidgetControl, GeoJSON \n", |
38 | 36 | "\n", |
39 | 37 | "\n", |
40 | | - "html = HTML('''\n", |
41 | | - " <h4> population density</h4>\n", |
42 | | - " Hover over a state\n", |
43 | | - "''')\n", |
| 38 | + "html = HTML('''Hover over a state''')\n", |
44 | 39 | "html.layout.margin = '0px 20px 20px 20px'\n", |
45 | 40 | "control = WidgetControl(widget=html, position='topright')\n", |
46 | 41 | "m.add_control(control)" |
|
54 | 49 | "source": [ |
55 | 50 | "def update_html(feature, **kwargs):\n", |
56 | 51 | " html.value = '''\n", |
57 | | - " <h5>Population density</h5>\n", |
58 | | - " <h5><b>{}</b></h5>\n", |
59 | | - " {} people \n", |
60 | | - " <h5><b> Continent : {} </b></h5>\n", |
61 | | - " <h15> GDP : {} </h15> \n", |
| 52 | + " <h3><b>{}</b></h3>\n", |
| 53 | + " <h4>Population: {:.2e} people</h4> \n", |
| 54 | + " <h4>Continent: {}</h4>\n", |
62 | 55 | " '''.format(feature['properties']['name'],\n", |
63 | 56 | " feature['properties']['pop_est'],\n", |
64 | | - " feature['properties']['continent'],\n", |
65 | | - " feature['properties']['gdp_md_est'])\n", |
| 57 | + " feature['properties']['continent'])\n", |
66 | 58 | "\n", |
67 | 59 | "geo_data.on_hover(update_html)" |
68 | 60 | ] |
69 | | - }, |
70 | | - { |
71 | | - "cell_type": "code", |
72 | | - "execution_count": null, |
73 | | - "metadata": {}, |
74 | | - "outputs": [], |
75 | | - "source": [ |
76 | | - "from ipyleaflet import FullScreenControl, LayersControl\n", |
77 | | - "m.add_control(FullScreenControl())" |
78 | | - ] |
79 | | - }, |
80 | | - { |
81 | | - "cell_type": "code", |
82 | | - "execution_count": null, |
83 | | - "metadata": {}, |
84 | | - "outputs": [], |
85 | | - "source": [] |
86 | 61 | } |
87 | 62 | ], |
88 | 63 | "metadata": { |
|
105 | 80 | } |
106 | 81 | }, |
107 | 82 | "nbformat": 4, |
108 | | - "nbformat_minor": 2 |
| 83 | + "nbformat_minor": 4 |
109 | 84 | } |
0 commit comments