Skip to content

Dashboard

image image image

Create a Dashboard

1
# %pip install leafmap
1
2
import leafmap.maplibregl as leafmap
import ipywidgets as widgets
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
tw = leafmap.TabWidget(
    title="Dashboard",
    tabs=("Home", "Map", "Settings"),
    icons=("mdi-home", "mdi-map", "mdi-cog"),
    show_panel_titles=False,
)

# Customize dialog
tw.set_help_title("About this dashboard")
tw.set_help_content(widgets.HTML("""
      <p><b>Shortcuts</b></p>
      <ul>
        <li>1 / 2 / 3 — switch tabs</li>
        <li>R — refresh</li>
        <li>? — help</li>
      </ul>
    """))

m = leafmap.Map(
    projection="globe", style="liberty", sidebar_visible=True, height="800px"
)
m.create_container()

home_tab = widgets.HTML("""
    <h1>Welcome to the Leafmap Visualization Dashboard</h1>
    <p>This is the home tab.</p>
    <img src="https://assets.gishub.org/images/geog-312.png" width="100%">
    """)

settings_tab = widgets.HTML("""
    <h1>Settings</h1>
    <p>This is the settings tab.</p>
    """)

tw.set_tab_content(0, home_tab)
tw.set_tab_content(1, m.container)
tw.set_tab_content(2, settings_tab)

display(tw.widget)