ArcGIS Developers
Dashboard

ArcGIS API for Python

Authoring ArcGIS Dashboards using arcgis.apps.dashboard

Introduction

A dashboard is a view of geographic information and data that allows you to monitor events, make decisions, inform others, and see trends. Dashboards are designed to display multiple visualizations that work together on a single screen. They offer a comprehensive view of your data and provide key insights for at-a-glance decision-making.

The arcgis.apps module includes Dashboard submodule to create dashboards programmatically. The arcgis.apps.dashboard submodule contains classes for different widgets which can be configured and added to a dashboard.

Dashboards are composed of configurable elements, such as maps, lists, charts, gauges, and indicators etc. All of these elements can be added to a dashboard after it is configured by setting the properties and values for data. Most of the elements are equipped with getters and setters to access information. Each element has a title, name, description, width and height which can be set using the setters provided. Elements can be stacked or grouped together in various ways.

The Dashboard elements could be imported by running the following command:

In [1]:
from arcgis.apps.dashboard import Gauge, MapLegend, NumberSelector, PieChart, RichText, \
SidePanel,Indicator, List, SerialChart, CategorySelector, DatePicker, Details, EmbeddedContent

Let's understand each of the Dashboard elements in detail.

Header

A header is a reserved area along the top of your dashboard that can be used for giving your dashboard a unique identity, applying corporate branding standards, and providing links to additional content. It can also be used in interactive dashboards to host one or more selectors. A dashboard can only have one header, and it's designed to always occupy the entire width of a dashboard.

Using the API, values for a Header can be set as shown below:

In [ ]:
Header(
    title=None,
    subtitle=None,
    margin=True,
    size="medium",
    logo_image_url=None,
    logo_url=None,
    background_image_url=None,
    background_image_size="fit-width",
    background_image_position="left",
    signout_link=False,
    menu_links=None
)

A header widget can be used to add a title, subtitle for the dashboard. The margin parameter is used to set margin around the header whereas the size parameter can be used to set the overall size of the header. A logo can be embedded into the header using the logo_image_url parameter and this logo can optionally be hyperlinked using the logo_url parameter. It can also contain a background image, specified using background_image_url. The size and position of the background can be set using the background_image_size, background_image_position parameters respectively. The header can also contain a sign out link, set using the signout_link parameter. It can also have multiple links, specified using the menu_links parameter.

Side Panel

The side panel is used in interactive dashboards to host one or more selectors. A dashboard can only have one side panel, which has a fixed size and position along the dashboard's edge, although you can configure it to be retractable at run time.

In [4]:
side_panel = SidePanel()

A Side Panel widget can be initialized without any parameters. Once initialized, the widget has setters to set the background and text color. The allow_sliding setter can be enabled to allow the side panel to have a sliding effect.

A number selector, category selector or a date picker can be added to the side panel using the add_selector function.

Number Selector

A number selector widget can be added to both Side Panel and Header widgets. A number selector can of two types, a range based number selector or single value picker.

In [ ]:
number_selector = NumberSelector(range=True,
                                 label='Give a name to your selector', 
                                 operator='less than')

range parameter can be set to True to create a range based number selector. A label to widget can be added using the label parameter and display_type parameter defines the interface of the widget, it can be anything from "spinner", "slider", "input".

For a non-range or single value number selector an operator parameter can be passed to define a relationship with the value selected. It can take values from "equal", "not equal", "greater than", "greater than or equal", "less than", "less than or equal".

A factor for each increment can also be specified using a parameter increment_factor while initializing. The number selector is equipped with setters to allow setting up placeholder text for both range and single values selector.

The minimum and maximum limits for selector can be set using either using set_defined_limits or set_statistics_limits function.

Date Picker

A date picker widget can be added to both Side Panel and Header widgets. Date Picker can be of two types, a range date picker or a single date picker.

In [3]:
date_picker = DatePicker()

When initializing the range parameter can be set to True to create a range date picker. A label for the widget can be added using the label parameter.

For a single date picker, the operator parameter can be set to describe the relation with value being picked. The operator parameter can take values from is", "is not", "is before", "is or is before", "is after", "is or is after". The default value for the single date picker can be specified using the value parameter.

For a range date picker, default values can be specified passing min_value and max_value parameter. Accepted values for the default values are None, "Today", or a fixed value in 24 hours format (year, month, day, hour, minutes) or (year, month, day).

Category Selector

The category selector widget can be initialized as follows:

In [2]:
category_selector = CategorySelector()

The categories can be set using set_defined_values, set_feature_options or set_group_by_values function.

set_defined_values function takes in key-value pairs of labels and their corresponding values whereas set_feature_options function can be used to set the category options from an arcgis.gis.Item object. The field_name parameter can be specified to select the field from which the values will be populated.

set_group_by_values function also works with an arcgis.gis.Item object and the field can be specified using the category_field parameter.

CategorySelectorProperties accessible using the selector getter, helps in setting various properties related to the category selector widget like the preferred display, label, display threshold etc.

A category selector widget can be added to both Side Panel and Header widgets.

In [ ]:
side_panel.add_selector(category_selector)

Map Element

Maps play a central role in many dashboards. Not only are they often the most effective way to display your geographic information, but their operational layers can also be used by other data visualizations on the dashboard to create interesting, intuitive, and compelling information products.

In [ ]:
WebMap(item)

A Map widget can be created using the existing arcgis.mapping.WebMap object. Once the object is created, we can enable and disable the properties pop_ups, navigation, legend, layer_visibility, basemap_switcher, search and zoom. The scale_bar property can be set to "none", "ruler", "scale" to define the type of scale.

Events object, accessible using the events getter can be used to sync maps and widgets using the sync_map and sync_widget functions.

Map Legend

In general, a map legend conveys the meaning of symbols that represent map features. It is particularly useful when the map has multiple operational or thematic layers. The legend element displays the legend of the web map you've created for your dashboard, just like the map element displays this web map.

In [ ]:
MapLegend(map_widget)

A MapLegend widget can be initialised by passing a map widget or arcgis.mapping.WebMap object. The map legend widget picks the legend from the Map object and add a new element to the dashboard.

Serial Chart

A serial chart visualizes one or more series of data points along a horizontal (x) axis and a vertical (y) axis. Serial charts get their name from an ability to show more than one series of data. In the following chart, there are two series of data: one showing crime counts by day and the other showing a three-day rolling average of crime counts. Each series in a serial chart has a type that determines the way the data points are visualized. In the following example, the series showing crime counts by day has the bar type and the series showing the three-day rolling average of crime counts has the line type.