Skip to content

Tile#

Tile #

Tile(
    data: DataType | dict[str, Any],
    *,
    items: list[TileContentItem | str] | None = None,
    widget_id: str | None = None,
    header: Header | None = None,
    show_separator: bool = True,
    orientation: Orientation = HORIZONTAL,
    height: int | float | None = None,
)

Spec for Tile Widget.

Construct spec for the Tile Widget.

Parameters:

Name Type Description Default
items list[TileContentItem | str] | None

list of items to be displayed in the tile widget.

None
widget_id str | None

unique widget id in a dashboard.

None
data DataType | dict[str, Any]

data to be used by widget. Accepts Storages as well as raw data.

required
header Header | None

spec for the header in Tile widget.

None
show_separator bool

flag to show or hide separator.

True
orientation Orientation

orientation of items in tile widget content.

HORIZONTAL
height int | float | None

height value for the widget. Defaults to 0.84 (84px).

None
Note

If data is a Http or a Http connector dependency, make sure that the return from the http request is a dictionary.

Examples:#

Create a minimal Tile Widget

from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile

data = {
    "number": 10,
    "text": "Hello World",
    "line_chart": [1, 2, 3, 4, 5],
}

tile_widget = tile.Tile(data=data)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=tile_widget,
)
minimal tile widget

Create a Tile widget with vertical orientation

from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile

data = {
    "number": 10,
    "text": "Hello World",
    "line_chart": [1, 2, 3, 4, 5],
}

tile_widget = tile.Tile(
    data=data,
    orientation=tile.Orientation.VERTICAL,
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=tile_widget,
)
vertical tile

Header #

Header(
    *,
    icon: TemplatedStringItem | DataField | None = None,
    title: TemplatedStringItem | DataField | None = None,
    item: HeaderNumberItem | None = None,
    link: Actions | None = None,
)

Spec for Tile Header.

Construct spec for the Tile Widget Header.

Parameters:

Name Type Description Default
icon TemplatedStringItem | DataField | None

str that will be icon of header.

None
title TemplatedStringItem | DataField | None

str that will be title of header.

None
item HeaderNumberItem | None

tile header number item.

None
link Actions | None

action widget link spec.

None

Example:#

Create a Tile widget with a header

from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile

data = {
    "number": 10,
    "text": "Hello World",
    "line_chart": [1, 2, 3, 4, 5],
}

tile_widget = tile.Tile(
    data=data,
    header=tile.Header(title="Tile Widget Example"),
    orientation=tile.Orientation.VERTICAL,
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=tile_widget,
)
vertical tile with header

HeaderNumberItem #

HeaderNumberItem(
    *,
    value_key: TemplatedStringItem,
    formatting: NumberFormatting | None = None,
    label: TemplatedStringItem | DataField | None = None,
    styling: TileHeaderNumberStyling | None = None,
)

Spec for Tile Header Number Item.

Construct spec for the Tile Header Number Item class.

Parameters:

Name Type Description Default
value_key TemplatedStringItem

key in data that will have the values used by the item.

required
formatting NumberFormatting | None

formatting spec.

None
label TemplatedStringItem | DataField | None

label the item values.

None
styling TileHeaderNumberStyling | None

styling spec for number header item.

None

NumberStylingChip #

NumberStylingChip(
    *,
    color_spec: ColorSpec,
    data_column: TemplatedStringItem | None = None,
)

Spec for Number Chip Styling class.

Construct spec for Number Chip Styling.

Parameters:

Name Type Description Default
color_spec ColorSpec

specs for color.

required
data_column Optional[TemplatedStringItem]

styling value key. Defaults to None.

None

NumberStylingDot #

NumberStylingDot(
    *,
    color_spec: ColorSpec,
    data_column: TemplatedStringItem | None = None,
)

Spec for Number Dot Styling class.

Construct spec for Number Dot Styling.

Parameters:

Name Type Description Default
color_spec ColorSpec

specs for color.

required
data_column Optional[TemplatedStringItem]

styling value key.

None

NumberStylingFont #

NumberStylingFont(
    *,
    color_spec: ColorSpec,
    data_column: TemplatedStringItem | None = None,
)

Spec for Number Font Styling class.

Construct spec for Number Font Styling.

Parameters:

Name Type Description Default
color_spec Optional[ColorSpec

specs for color.

required
data_column Optional[TemplatedStringItem]

styling value key. Defaults to None.

None

Items#

NumberItem #

NumberItem(
    *,
    data_column: TemplatedStringItem,
    formatting: NumberFormatting | None = None,
    label: TemplatedStringItem | DataField | None = None,
    required: bool = True,
    styling: TileNumberStyling | None = None,
)

Spec for Tile Number Item.

Construct spec for the Tile Number Item class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

key in data that will have the values used by the item.

required
formatting NumberFormatting | None

formatting spec.

None
label TemplatedStringItem | DataField | None

str that will label the item values.

None
required bool

Flag to make Number item mandatory. If required is True and no Data the widget will show an error. If required is False and no Data, the item is not shown.

True
styling TileNumberStyling | None

styling spec for number item.

None

Example:#

Create a Tile widget with a number item

import pandas as pd

from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile

data = pd.DataFrame(
    [
        {
            "tile_number_item": 1000,
        }
    ]
)

tile_widget = tile.Tile(
    data=data,
    items=[tile.NumberItem(data_column="tile_number_item")],
    orientation=tile.Orientation.VERTICAL,
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=tile_widget,
)
vertical tile with number item

TextItem #

TextItem(
    *,
    data_column: TemplatedStringItem,
    formatting: TextFormatting | None = None,
    label: TemplatedStringItem | DataField | None = None,
    required: bool = True,
    styling: TileTextStyling | None = None,
)

Spec for Tile content text Item.

Construct spec for the Tile Text Item class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

key in data that will have the valuesused by the item.

required
formatting

formatting spec.

None
label TemplatedStringItem | DataField | None

str that will label the item values.

None
required bool

Flag to make Number item mandatory. If required is True and no Data the widget will show an error. If required is False and no Data, the item is not shown.

True
styling TileTextStyling | None

styling spec for text item.spec for a fixed reference line.

None

Example:#

Create a Tile widget with a text item

import pandas as pd

from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile

data = pd.DataFrame(
    [
        {
            "text_item_data": "This is a text item",
        }
    ]
)

tile_widget = tile.Tile(
    data=data,
    items=[tile.TextItem(data_column="text_item_data")],
    orientation=tile.Orientation.VERTICAL,
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=tile_widget,
)
vertical tile with text item

DateItem #

DateItem(
    *,
    data_column: TemplatedStringItem,
    formatting: DateTimeFormatting | None = None,
    label: TemplatedStringItem | DataField | None = None,
    required: bool = True,
)

Spec for Tile Date Item.

Construct spec for the Tile Date Item class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

key in data that will have the values used by the item.

required
formatting DateTimeFormatting | None

formatting spec.

None
label TemplatedStringItem | DataField | None

str that will label the item values.

None
required bool

Flag to make Number item mandatory. If required is True and no Data the widget will show an error. If required is False and no Data, the item is not shown.

True

Example:#

Create a Tile widget with a date item

import pandas as pd
from datetime import datetime as dt

from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile

data = pd.DataFrame(
    [
        {
            "date_key": dt(2013, 2, 1).timestamp(),
        }
    ]
)

tile_widget = tile.Tile(
    data=data,
    items=[tile.DateItem(data_column="date_key")],
    orientation=tile.Orientation.VERTICAL,
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=tile_widget,
)
vertical tile with date item

LineChartItem #

LineChartItem(
    *,
    data_column: TemplatedStringItem,
    reference_line: int | float | DataField | None = None,
    styling: Palette | LineChartItemStyling | None = None,
    formatting: NumberFormatting | None = None,
    label: TemplatedStringItem | DataField | None = None,
    tooltip: ChartTooltip | None = None,
    required: bool = True,
)

Spec for Tile Line Chart Item.

Construct spec for the TileLineChartItem class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

key in data that will have the values used by the item.

required
reference_line int | float | DataField | None

spec for a fixed reference line.

None
styling Palette | LineChartItemStyling | None

styling spec for item charts.

None
formatting NumberFormatting | None

formatting spec.

None
label TemplatedStringItem | DataField | None

label the item values.

None
tooltip ChartTooltip | None

specs for tooltip.

None
required bool

Flag to make Number item mandatory. If required is True and no Data the widget will show an error. If required is False and no Data, the item is not shown.

True

Example:#

Create a Tile widget with a line chart item

import pandas as pd

from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile

data = pd.DataFrame(
    [
        {
            "value_column_line": [10, 2, 3, 8, 5, 11, 15],
        }
    ]
)

tile_widget = tile.Tile(
    data=data,
    items=[tile.LineChartItem(data_column="value_column_line")],
    orientation=tile.Orientation.VERTICAL,
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=tile_widget,
)
vertical tile with line chart item

ColumnChartItem #

ColumnChartItem(
    *,
    data_column: TemplatedStringItem,
    reference_line: int | float | DataField | None = None,
    styling: Palette | ColumnChartItemStyling | None = None,
    formatting: NumberFormatting | None = None,
    label: TemplatedStringItem | DataField | None = None,
    tooltip: ChartTooltip | None = None,
    required: bool = True,
)

Spec for Tile Column Chart Item.

Construct spec for the TileColumnChartItem class.

Parameters:

Name Type Description Default
reference_line int | float | DataField | None

spec for a fixed reference line.

None
styling Palette | ColumnChartItemStyling | None

styling spec for item charts.

None
data_column TemplatedStringItem

key in data that will have the values used by the item.

required
formatting NumberFormatting | None

formatting spec.

None
label TemplatedStringItem | DataField | None

label the item values.

None
tooltip ChartTooltip | None

specs for tooltip.

None
required bool

Flag to make Number item mandatory. If required is True and no Data the widget will show an error. If required is False and no Data, the item is not shown.

True

Example:#

Create a Tile widget with a column chart item

import pandas as pd

from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile

data = pd.DataFrame(
    [
        {
            "value_column": [1, 2, 3, 4, 5, 6, 7],
        }
    ]
)

tile_widget = tile.Tile(
    data=data,
    items=[tile.ColumnChartItem(data_column="value_column")],
    orientation=tile.Orientation.VERTICAL,
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=tile_widget,
)
vertical tile with column chart item

AreaChartItem #

AreaChartItem(
    *,
    data_column: TemplatedStringItem,
    reference_line: int | float | DataField | None = None,
    styling: Palette | AreaChartItemStyling | None = None,
    formatting: NumberFormatting | None = None,
    label: TemplatedStringItem | DataField | None = None,
    tooltip: ChartTooltip | None = None,
    required: bool = True,
)

Spec for Tile Area Chart Item.

Construct spec for the TileAreaChartItem class.

Parameters:

Name Type Description Default
reference_line int | float | DataField | None

spec for a fixed reference line.

None
styling Palette | AreaChartItemStyling | None

styling spec for item charts.

None
data_column TemplatedStringItem

key in data that will have the values used by the item.

required
formatting NumberFormatting | None

formatting spec.

None
label TemplatedStringItem | DataField | None

str that will label the item values.

None
tooltip ChartTooltip | None

specs for tooltip.

None
required bool

Flag to make Number item mandatory. If required is True and no Data the widget will show an error. If required is False and no Data, the item is not shown.

True

Example:#

Create a Tile widget with an area chart item

import pandas as pd

from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile

data = pd.DataFrame(
    [
        {
            "value_column_area": [5, 2, 3, 10, 12, 9, 11],
        }
    ]
)

tile_widget = tile.Tile(
    data=data,
    items=[tile.AreaChartItem(data_column="value_column_area")],
    orientation=tile.Orientation.VERTICAL,
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=tile_widget,
)
vertical tile with area chart item

StackedBarChartItem #

StackedBarChartItem(
    *,
    data_column: TemplatedStringItem,
    bar_label_key: TemplatedStringItem,
    styling: Palette
    | StackedBarChartItemStyling
    | None = None,
    formatting: NumberFormatting | None = None,
    label: TemplatedStringItem | DataField | None = None,
    required: bool = True,
)

Spec for Tile Stack Bar Chart Item.

Construct spec for the TileColumnChartItem class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

key in data that will have the values used by the item.

required
bar_label_key TemplatedStringItem

key in data that will have the labels used by each bar.

required
styling Palette | StackedBarChartItemStyling | None

styling spec for item charts.

None
formatting NumberFormatting | None

formatting spec.

None
label TemplatedStringItem | DataField | None

str that will label the item values.

None
required bool

Flag to make Number item mandatory. If required is True and no Data the widget will show an error. If required is False and no Data, the item is not shown.

True

Example:#

Create a Tile widget with a stacked bar chart item

import pandas as pd

from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile
from engineai.sdk.dashboard.styling.color.palette import Palette
from engineai.sdk.dashboard.styling.color.discrete_map import DiscreteMap
from engineai.sdk.dashboard.styling.color.discrete_map import DiscreteMapValueItem

data = pd.DataFrame(
    [
        {
            "stacked_bar_series": [1, 2, 3, 4],
            "stacked_bar_labels": ["a", "b", "c", "d"],
        }
    ]
)

tile_widget = tile.Tile(
    data=data,
    items=[
        tile.StackedBarChartItem(
            data_column="stacked_bar_series",
            bar_label_key="stacked_bar_labels",
            styling=tile.StackedBarChartItemStyling(
                color_spec=DiscreteMap(
                    DiscreteMapValueItem(value=1, color=Palette.AQUA_GREEN),
                    DiscreteMapValueItem(value=2, color=Palette.RUBI_RED),
                    DiscreteMapValueItem(value=3, color=Palette.BABY_BLUE),
                    DiscreteMapValueItem(value=4, color=Palette.BANANA_YELLOW),
                ),
                data_column="stacked_bar_series",
            ),
        )
    ],
    orientation=tile.Orientation.VERTICAL,
)

Dashboard(
    workspace_slug="my-workspace",
    app_slug="my-app",
    slug="first-dashboard",
    content=tile_widget,
)
vertical tile with stacked bar chart item

Items Styling#

NumberStylingArrow #

NumberStylingArrow(
    *,
    data_column: TemplatedStringItem | None = None,
    color_divergent: Divergent,
)

Spec for Number Arrow Styling class.

Construct spec Number Arrow Styling.

Parameters:

Name Type Description Default
color_divergent ColorDivergent

specs for color.

required
data_column TemplatedStringItem

styling value key.

None

NumberStylingChip #

NumberStylingChip(
    *,
    color_spec: ColorSpec,
    data_column: TemplatedStringItem | None = None,
)

Spec for Number Chip Styling class.

Construct spec for Number Chip Styling.

Parameters:

Name Type Description Default
color_spec ColorSpec

specs for color.

required
data_column Optional[TemplatedStringItem]

styling value key. Defaults to None.

None

NumberStylingDot #

NumberStylingDot(
    *,
    color_spec: ColorSpec,
    data_column: TemplatedStringItem | None = None,
)

Spec for Number Dot Styling class.

Construct spec for Number Dot Styling.

Parameters:

Name Type Description Default
color_spec ColorSpec

specs for color.

required
data_column Optional[TemplatedStringItem]

styling value key.

None

NumberStylingFont #

NumberStylingFont(
    *,
    color_spec: ColorSpec,
    data_column: TemplatedStringItem | None = None,
)

Spec for Number Font Styling class.

Construct spec for Number Font Styling.

Parameters:

Name Type Description Default
color_spec Optional[ColorSpec

specs for color.

required
data_column Optional[TemplatedStringItem]

styling value key. Defaults to None.

None

TextStylingDot #

TextStylingDot(
    *,
    color_spec: ColorSpec | None = None,
    data_column: TemplatedStringItem | None = None,
)

Spec for Text Dot Styling Class.

Construct spec for Text Dot Styling.

Parameters:

Name Type Description Default
color_spec Optional[ColorSpec

specs for color.

None
data_column Optional[TemplatedStringItem]

styling value key. Defaults to None.

None

TextStylingFont #

TextStylingFont(
    *,
    color_spec: ColorSpec | None = None,
    data_column: TemplatedStringItem | None = None,
)

Spec for Text Font Styling Class.

Construct spec for Text Font Styling.

Parameters:

Name Type Description Default
color_spec ColorSpec

specs for color.

None
data_column Optional[TemplatedStringItem]

styling value key. Defaults to None.

None

LineChartItemStyling #

LineChartItemStyling(
    *,
    color_spec: ColorSpec | None = None,
    data_column: TemplatedStringItem | None = None,
)

Spec for styling used by Spark Line Chart Item.

ColumnChartItemStyling #

ColumnChartItemStyling(
    *,
    color_spec: ColorSpec | None = None,
    data_column: TemplatedStringItem | None = None,
)

Spec for styling used by Spark Column Chart Item.

AreaChartItemStyling #

AreaChartItemStyling(
    *,
    color_spec: ColorSpec | None = None,
    data_column: TemplatedStringItem | None = None,
)

Spec for styling used by Spark Area Chart Item.

StackedBarChartItemStyling #

StackedBarChartItemStyling(
    *,
    color_spec: ColorSpec | None = None,
    data_column: TemplatedStringItem | None = None,
)

Spec for styling used by Stacked Bar Chart Item.

Enums#

Orientation #

Options for orientation of Tile Widget.

Attributes:

Name Type Description
VERTICAL str

Vertical orientation.

HORIZONTAL str

Horizontal orientation.

Types#

Actions module-attribute #

Actions = UrlLink | ExternalEvent

TileContentItem module-attribute #

TileHeaderNumberStyling module-attribute #

TileHeaderNumberStyling = (
    NumberStylingChip | NumberStylingDot | NumberStylingFont
)

TileNumberStyling module-attribute #

TileTextStyling module-attribute #

TileTextStyling = TextStylingDot | TextStylingFont