Map Page

The page of the app that generates the map view of the data.

This data store is used to trigger callbacks on page load and to know which page is loaded.

Setup some of the key data contiaining objects

Customize the Layout


source

layout

def layout():

Call self as a function.

Global Variables

Some things to note about this page

  • On Load, we change geo to province if it isn’t alread there,
  • We can just use the normal geo drowpdown because it is set to and will remain as Province, the other dropdown is basically just for display,
  • As a result, we can recycle a lot of the other dropdowns,
  • Probably the only other one we will overwrite is the map one, to instead display population data.
  • Also we add the age bracket dropdown
  • And we use a different measure and variable selection
  • It’s really just updated to display new data not change to much of the other variables and callbacks

Build callbacks to create interaction

Update the variable dropdowns based on the selection of the overall variable

Update the measure selection from Population Pyramid clicks

Update the selected part of the map based on the dropdown

Population Pyramid

On click, update the contents of the kpi’s

Update Kpi

Based on Current Selection


source

update_kpi

def update_kpi(
    data_type:str, # User input of type of data
    measure:str, # A string contiaining the census variable and measure split by ':'
    loc_selection:[<class 'str'>], # The selected locations, may be none
    ages:[<class 'str'>], # Currently selected locations for highlighting
    year:str, # Year of projection data
    variable:str, # The state of the variable dropdown
)->(<class 'dash.dcc.Markdown.Markdown'>, <class 'dash.dcc.Markdown.Markdown'>): # Returns a graph object figure after being updated and the dynamic title

Updates the focus census variable or geography dispalayed on the map