Skip to content

TileMatrix#

TileMatrix #

TileMatrix(
    data: DataType | DataFrame,
    *,
    widget_id: str | None = None,
    max_columns: int | None = None,
    item: TileMatrixItem | str | None = None,
)

Spec for Tile Matrix Widget.

Construct spec for the Tile Matrix Widget.

Parameters:

Name Type Description Default
data DataType | DataFrame

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

required
widget_id str | None

unique widget id in a dashboard.

None
max_columns int | None

maximum number of columns to be displayed.

None
item TileMatrixItem | str | None

Tile Matrix item. If not provided, it will look into the first column of the data and decide the item type.

None

Example:#

Create a minimal Tile Matrix Widget

import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile_matrix

data = pd.DataFrame([{"number": i} for i in range(1, 5)])

tile_matrix_widget = tile_matrix.TileMatrix(data=data)

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

BaseTileMatrixChartItem #

BaseTileMatrixChartItem(
    *,
    data_column: TemplatedStringItem,
    label: TemplatedStringItem | DataField | None = None,
    icon: TemplatedStringItem | DataField | None = None,
    link: Actions | None = None,
    formatting: ItemFormatting | None = None,
    styling: Styling | None = None,
    required: bool = True,
)

Spec for Base Tile Matrix Chart Items.

Items#

Chart#

AreaChartItem #

AreaChartItem(
    *,
    data_column: TemplatedStringItem,
    label: TemplatedStringItem | DataField | None = None,
    icon: TemplatedStringItem | DataField | None = None,
    link: Actions | None = None,
    formatting: NumberFormatting | None = None,
    styling: Palette | AreaChartItemStyling | None = None,
    reference_line: int | float | DataField | None = None,
)

Spec for Tile Matrix Area Chart Item.

Construct spec for the TileMatrixAreaChartItem class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

column that has the value to be represented.

required
label TemplatedStringItem | DataField | None

Label text to be displayed.

None
icon TemplatedStringItem | DataField | None

icon to be displayed.

None
link Actions | None

link or action to be executed in the URL Icon.

None
formatting NumberFormatting | None

formatting spec.

None
styling Palette | AreaChartItemStyling | None

styling spec.

None
reference_line int | float | DataField | None

spec for a fixed reference line.

None

Example:#

Create a Tile Matrix with an area chart item

import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile_matrix
from engineai.sdk.dashboard.styling.color.palette import Palette
from engineai.sdk.dashboard.templated_string import DataField

data = pd.DataFrame(
    [
        {
            "value_column_area": [1, 2, 3, 4, 5, 6, 7],
            "label_text": "Some label",
        }
        for _ in range(4)
    ]
)

tile_matrix_widget = tile_matrix.TileMatrix(
    data=data,
    item=tile_matrix.AreaChartItem(
        data_column="value_column_area",
        label=DataField("label_text"),
        styling=tile_matrix.AreaChartItemStyling(color_spec=Palette.AQUA_GREEN),
    ),
)

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

ColumnChartItem #

ColumnChartItem(
    *,
    data_column: TemplatedStringItem,
    label: TemplatedStringItem | DataField | None = None,
    icon: TemplatedStringItem | DataField | None = None,
    link: Actions | None = None,
    formatting: NumberFormatting | None = None,
    styling: Palette | ColumnChartItemStyling | None = None,
    reference_line: int | float | DataField | None = None,
)

Spec for Tile Matrix Column Chart Item.

Construct spec for the TileMatrixColumnChartItem class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

column that has the value to be represented.

required
label TemplatedStringItem | DataField | None

Label text to be displayed.

None
icon TemplatedStringItem | DataField | None

icon to be displayed.

None
link

link or action to be executed in the URL Icon.

None
formatting NumberFormatting | None

formatting spec.

None
styling Palette | ColumnChartItemStyling | None

styling spec.

None
reference_line int | float | DataField | None

spec for a fixed reference line.

None

Example:#

Create a Tile Matrix with a column chart item

import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile_matrix
from engineai.sdk.dashboard.styling.color.palette import Palette
from engineai.sdk.dashboard.templated_string import DataField

data = pd.DataFrame(
    [
        {
            "value_column": [1, 2, 3, 4, 5, 6, 7],
            "label_text": "Some label",
        }
        for _ in range(4)
    ]
)

tile_matrix_widget = tile_matrix.TileMatrix(
    data=data,
    item=tile_matrix.ColumnChartItem(
        data_column="value_column",
        label=DataField("label_text"),
        styling=tile_matrix.AreaChartItemStyling(color_spec=Palette.AQUA_GREEN),
    ),
)

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

LineChartItem #

LineChartItem(
    *,
    data_column: TemplatedStringItem,
    label: TemplatedStringItem | DataField | None = None,
    icon: TemplatedStringItem | DataField | None = None,
    link: Actions | None = None,
    formatting: NumberFormatting | None = None,
    styling: Palette | LineChartItemStyling | None = None,
    reference_line: int | float | DataField | None = None,
)

Spec for Tile Matrix Line Chart Item.

Construct spec for the TileMatrixLineChartItem class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

column that has the value to be represented.

required
label TemplatedStringItem | DataField | None

Label text to be displayed.

None
icon TemplatedStringItem | DataField | None

icon to be displayed.

None
link Actions | None

link or action to be executed in the URL Icon.

None
formatting NumberFormatting | None

formatting spec.

None
styling Palette | LineChartItemStyling | None

styling spec.

None
reference_line int | float | DataField | None

spec for a fixed reference line.

None

Example:#

Create a Tile Matrix with a line chart item

import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile_matrix
from engineai.sdk.dashboard.styling.color.palette import Palette
from engineai.sdk.dashboard.templated_string import DataField

data = pd.DataFrame(
    [
        {
            "value_column_line": [10, 2, 3, 8, 5, 11, 15],
            "label_text": "Some label",
        }
        for _ in range(4)
    ]
)

tile_matrix_widget = tile_matrix.TileMatrix(
    data=data,
    item=tile_matrix.LineChartItem(
        data_column="value_column_line",
        label=DataField("label_text"),
        styling=tile_matrix.AreaChartItemStyling(color_spec=Palette.RUBI_RED),
    ),
)

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

StackedBarChartItem #

StackedBarChartItem(
    *,
    data_column: TemplatedStringItem,
    label: TemplatedStringItem | DataField | None = None,
    icon: TemplatedStringItem | DataField | None = None,
    bar_label_column: TemplatedStringItem | None = None,
    link: Actions | None = None,
    formatting: NumberFormatting | None = None,
    styling: Palette
    | StackedBarChartItemStyling
    | None = None,
)

Spec for Tile Matrix Stacked Bar Chart Item.

Construct spec for the TileMatrixStackedBarChartItem class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

column that has the value to be represented.

required
label TemplatedStringItem | DataField | None

Label text to be displayed.

None
icon TemplatedStringItem | DataField | None

icon to be displayed.

None
bar_label_column TemplatedStringItem | None

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

None
link Actions | None

link or action to be executed in the URL Icon.

None
formatting NumberFormatting | None

formatting spec.

None
styling Palette | StackedBarChartItemStyling | None

styling spec.

None

Example:#

Example:#

Create a Tile Matrix with an stacked bar chart item

import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile_matrix
from engineai.sdk.dashboard.styling.color.palette import Palette
from engineai.sdk.dashboard.templated_string import DataField
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"],
            "label_text": "Some label",
        }
        for _ in range(4)
    ]
)

tile_matrix_widget = tile_matrix.TileMatrix(
    data=data,
    item=tile_matrix.StackedBarChartItem(
        data_column="stacked_bar_series",
        label=DataField("label_text"),
        bar_label_column="stacked_bar_labels",
        styling=tile_matrix.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",
        ),
    ),
)

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

Styling#

AreaChartItemStyling #

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

Spec for styling used by Spark Area Chart Item.

ColumnChartItemStyling #

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

Spec for styling used by Spark Column Chart Item.

LineChartItemStyling #

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

Spec for styling used by Spark Line Chart Item.

StackedBarChartItemStyling #

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

Spec for styling used by Stacked Bar Chart Item.

Number#

NumberItem #

NumberItem(
    *,
    data_column: TemplatedStringItem,
    label: TemplatedStringItem | DataField | None = None,
    icon: TemplatedStringItem | DataField | None = None,
    link: Actions | None = None,
    formatting: NumberFormatting | None = None,
    styling: TileMatrixNumberItemStyling | None = None,
    required: bool = True,
)

Spec for Tile Matrix Number Item.

Construct spec for the TileMatrixNumberItem class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

column that has the value to be represented.

required
label TemplatedStringItem | DataField | None

Label text to be displayed.

None
icon TemplatedStringItem | DataField | None

icon to be displayed.

None
link Actions | None

link or action to be executed in the URL Icon.

None
formatting NumberFormatting | None

formatting spec.

None
styling TileMatrixNumberItemStyling | None

styling spec.

None
required bool

Flag to make Number item mandatory.

True

Example:#

Create a Tile Matrix with a number item

import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile_matrix

data = pd.DataFrame(
    [
        {
            "value_column_number": 1000,
            "number_item": 1000,
        }
        for _ in range(4)
    ]
)

tile_matrix_widget = tile_matrix.TileMatrix(
    data=data,
    item=tile_matrix.NumberItem(
        data_column="value_column_number",
        label="Some label text",
        styling=tile_matrix.NumberStylingBackground(
            data_column="number_item",
        ),
    ),
)

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

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

NumberStylingBackgroundArrow #

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

Spec for Tile Matrix Styling Background Arrow class.

Construct spec for TileMatrixStylingBackgroundArrow class.

Parameters:

Name Type Description Default
color_divergent Divergent

specs for color.

required
data_column TemplatedStringItem | None

styling value key.

None

NumberStylingBackground #

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

Spec for Tile Matrix Styling Background class.

Construct spec for TileMatrixStylingBackground class.

Parameters:

Name Type Description Default
color_spec ColorSpec | None

specs for color.

None
data_column TemplatedStringItem | None

styling value key.

None

Text#

TextItem #

TextItem(
    *,
    data_column: TemplatedStringItem,
    label: TemplatedStringItem | DataField | None = None,
    icon: TemplatedStringItem | DataField | None = None,
    link: Actions | None = None,
    formatting: TextFormatting | None = None,
    styling: TileMatrixTextItemStyling | None = None,
)

Spec for Tile Matrix Text Item.

Construct spec for the TileMatrixTextItem class.

Parameters:

Name Type Description Default
data_column TemplatedStringItem

column that has the value to be represented.

required
label TemplatedStringItem | DataField | None

Label text to be displayed.

None
icon TemplatedStringItem | DataField | None

icon to be displayed.

None
link Actions | None

link or action to be executed in the URL Icon.

None
formatting TextFormatting | None

formatting spec.

None
styling TileMatrixTextItemStyling | None

styling spec.

None

Example:#

Create a Tile Matrix widget with a text item

import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import tile_matrix
from engineai.sdk.dashboard.styling.color.palette import Palette
from engineai.sdk.dashboard.templated_string import DataField

data = pd.DataFrame(
    [
        {
            "value_column_text": "This is a text item",
            "label_text": "Some label",
        }
        for _ in range(4)
    ]
)

tile_matrix_widget = tile_matrix.TileMatrix(
    data=data,
    item=tile_matrix.TextItem(
        data_column="value_column_text",
        label=DataField("label_text"),
        styling=tile_matrix.TextStylingDot(
            color_spec=Palette.BANANA_YELLOW,
        ),
    ),
)

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

Styling#

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

TextStylingBackground #

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

Spec for Tile Matrix Text Background Styling class.

Construct spec for Tile Matrix Number Chip Styling.

Parameters:

Name Type Description Default
color_spec ColorSpec | None

specs for color.

None
data_column TemplatedStringItem | None

styling value key.

None

Types#

TileMatrixItem module-attribute #

TileMatrixItem = (
    NumberItem | TextItem | BaseTileMatrixChartItem
)

TileMatrixChartStyling module-attribute #

TileMatrixNumberItemStyling module-attribute #

TileMatrixTextItemStyling module-attribute #

TileMatrixTextItemStyling = (
    TextStylingDot | TextStylingFont | TextStylingBackground
)

Actions module-attribute #

Actions = UrlLink | ExternalEvent