Skip to content

Map#

Geo #

Geo(
    data: Union[DataType, T],
    *,
    series: Optional[MapSeries] = None,
    region_column: str = "region",
    color_axis: Optional[ColorAxis] = None,
    widget_id: Optional[str] = None,
    title: Optional[WidgetTitleType] = None,
    legend_position: LegendPosition = LegendPosition.BOTTOM,
    styling: Optional[MapStyling] = None,
    region: Region = Region.WORLD,
    tooltips: Optional[TooltipItems] = None
)

Widget for tailored geographic data visualization.

Allows the construction of a widget specifically tailored for geographical data visualization.

Constructor for Map Geo widget.

Parameters:

Name Type Description Default
data Union[DataType, T]

data source for the widget.

required
series Optional[MapSeries]

Series to be added to y axis.

None
region_column str

key to match region code in DS.

'region'
widget_id Optional[str]

unique widget id in a dashboard.

None
color_axis Optional[ColorAxis]

color axis spec.

None
title Optional[WidgetTitleType]

title of widget can be either a string (fixed value) or determined by a value from another widget using a WidgetField.

None
legend_position LegendPosition

location of position relative to data, maps.

BOTTOM
styling Optional[MapStyling]

styling for the map.

None
region Region

sets the region os the Map.

WORLD
tooltips Optional[TooltipItems]

tooltip items to be displayed at Chart level.

None

Examples:#

Create a minimal Map widget
import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import maps

data = pd.DataFrame(
    data=[
        {"region": "PT", "value": 10, "tooltip": "A"},
        {"region": "GB", "value": 100, "tooltip": "B"},
    ]
)
Dashboard(
    app_slug="engineai-docs-steps",
    workspace_slug="engineai-docs-steps",
    content=maps.Geo(data=data),
)

Components#

NumericSeries #

NumericSeries(
    *,
    data_column: TemplatedStringItem = "value",
    name: Optional[TemplatedStringItem] = None,
    formatting: Optional[NumberFormatting] = None,
    styling: Optional[Union[Palette, SeriesStyling]] = None,
    required: bool = True,
    tooltips: Optional[TooltipItems] = None
)

Spec for a numeric series of a Map widget.

Constructor for NumericSeries.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

data column to match field in DataStore.

'value'
name Optional[TemplatedStringItem]

series name (shown in legend and tooltip).

None
formatting Optional[NumberFormatting]

formatting spec for value.

None
styling Optional[Union[Palette, SeriesStyling]]

styling spec.

None
required bool

Flag to make the Series mandatory. If required == True and no Data the widget will show an error. If required==False and no Data, the widget hides the Series.

True
tooltips Optional[TooltipItems]

tooltip items to be displayed at Series level.

None

MapStyling #

MapStyling(*, label: Optional[MapStylingLabel] = None)

Spec for MapStyling of a Map Geo widget.

Construct a Styling for a Map Geo widget.

Parameters:

Name Type Description Default
label Optional[MapStylingLabel]

label style for map

None

ColorAxis #

ColorAxis(
    *,
    position: LegendPosition = LegendPosition.BOTTOM,
    formatting: Optional[NumberFormatting] = None
)

Spec for ColorAxis of a Map widget.

Construct a ColorAxis for a Map Shape widget.

Parameters:

Name Type Description Default
position LegendPosition

location of position relative to data, maps.

BOTTOM
formatting Optional[NumberFormatting]

formatting spec for value.

None

Tooltips#

CategoryTooltipItem #

CategoryTooltipItem(
    *,
    data_column: TemplatedStringItem,
    formatting: MapperFormatting,
    label: Optional[Union[str, DataField]] = None
)

Customize tooltips for categorical data in Chart widget.

Define specifications for a category tooltip item within a Chart widget to customize the appearance and content of tooltips displayed for categorical data.

Constructor for CategoryTooltipItem.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

name of column in pandas dataframe(s) used for the value of the tooltip item.

required
formatting MapperFormatting

tooltip formatting spec.

required
label Optional[Union[str, DataField]]

label to be used for tooltip item, it can be either a string or a DataField object.

None

CountryTooltipItem #

CountryTooltipItem(
    *,
    data_key: TemplatedStringItem,
    country: Union[str, DataField],
    styling: Optional[CountryTooltipItemStyling] = None,
    formatting: Optional[TextFormatting] = None
)

Customize tooltips for numerical data in Chart.

Define specifications for a Country item within a tooltip for a Chart widget to customize the appearance and content of tooltips displayed for country data.

Constructor for NumberTooltipItem.

Parameters:

Name Type Description Default
data_key TemplatedStringItem

name of key in pandas dataframe(s) used for the value of the tooltip item.

required
country Union[str, DataField]

country code.

required
styling Optional[CountryTooltipItemStyling]

styling specs.

None
formatting Optional[TextFormatting]

formatting specs.

None

DatetimeTooltipItem #

DatetimeTooltipItem(
    *,
    data_column: TemplatedStringItem,
    formatting: Optional[DateTimeFormatting] = None,
    label: Optional[Union[str, DataField]] = None
)

Customize tooltips for datetime data in Chart.

Define specifications for a datetime item within a tooltip for a Chart widget to customize the appearance and content of tooltips displayed for datetime data.

Constructor for DatetimeTooltipItem.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

name of column in pandas dataframe(s) used for the value of the tooltip item.

required
formatting DateTimeFormatting

tooltip formatting spec Defaults to DateTimeFormatting for Dates (i.e. not include HH:MM).

None
label Optional[Union[str, DataField]]

label to be used for tooltip item, it can be either a string or a DataField object.

None

NumberTooltipItem #

NumberTooltipItem(
    *,
    data_column: TemplatedStringItem,
    formatting: Optional[NumberFormatting] = None,
    label: Optional[Union[str, DataField]] = None
)

Customize tooltips for numerical data in Chart.

Define specifications for a number item within a tooltip for a Chart widget to customize the appearance and content of tooltips displayed for numerical data.

Constructor for NumberTooltipItem.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

name of column in pandas dataframe(s) used for the value of the tooltip item.

required
formatting Optional[NumberFormatting]

tooltip formatting spec. Defaults to None (Base NumberFormatting).

None
label Optional[Union[str, DataField]]

label to be used for tooltip item, it can be either a string or a DataField object.

None

TextTooltipItem #

TextTooltipItem(
    *,
    data_column: TemplatedStringItem,
    formatting: Optional[TextFormatting] = None,
    label: Optional[Union[str, DataField]] = None
)

Customize tooltips for textual data in Chart.

Define specifications for a text item within a tooltip for a Chart widget to customize the appearance and content of tooltips displayed for textual data.

Constructor for TextTooltipItem.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

name of column in pandas dataframe(s) used for the value of the tooltip item.

required
formatting Optional[TextFormatting]

tooltip formatting spec. Defaults to TextFormatting(max_characters=30).

None
label Optional[Union[str, DataField]]

label to be used for tooltip item, it can be either a string or a DataField object.

None

Enums#

LegendPosition #

Legend positioning options on map.

Options for positioning the legend on the map, including top, left, right, and bottom.

Attributes:

Name Type Description
TOP

Legend is placed on the top of the map.

LEFT

Legend is placed on the left side of the map.

RIGHT

Legend is placed on the right side of the map.

BOTTOM

Legend is placed on the bottom of the map.

Region #

Region options for map.

Options for defining the region of the map, such as world, Europe, USA, and North America.

Attributes:

Name Type Description
WORLD

World region.

EUROPE

Europe region.

USA

USA region.

NORTH_AMERICA

North America region.

SAUDI_ARABIA

Saudi Arabia region.