Skip to content

Tooltip#

Tooltip content and formatting.

Specify the content and formatting of tooltips, including categories, datetime, numbers, and text.

Items#

Styling items.

ChartTooltip #

ChartTooltip(
    title: str | DataField,
    formatting: TooltipItemFormatter | None = None,
)

Specs for number item for a tooltip.

Construct for ChartTooltip class.

Parameters:

Name Type Description Default
title Union[str, DataField]

header title spec.

required
formatting Optional[TooltipItemFormatter]

header tooltip formatting.

None

Charts#

CategoryTooltipItem #

CategoryTooltipItem(
    *,
    data_column: TemplatedStringItem,
    formatting: MapperFormatting,
    label: str | DataField | None = 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

DatetimeTooltipItem #

DatetimeTooltipItem(
    *,
    data_column: TemplatedStringItem,
    formatting: DateTimeFormatting | None = None,
    label: str | DataField | None = 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: NumberFormatting | None = None,
    label: str | DataField | None = 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 NumberFormatting | None

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

None
label str | DataField | None

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

None

TextTooltipItem #

TextTooltipItem(
    *,
    data_column: TemplatedStringItem,
    formatting: TextFormatting | None = None,
    label: str | DataField | None = 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

CountryTooltipItem #

CountryTooltipItem(
    *,
    data_key: TemplatedStringItem,
    country: str | DataField,
    styling: CountryTooltipItemStyling | None = None,
    formatting: TextFormatting | None = 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 str | DataField

country code.

required
styling CountryTooltipItemStyling | None

styling specs.

None
formatting TextFormatting | None

formatting specs.

None

CountryTooltipItemStylingFlag #

CountryTooltipItemStylingFlag(right_to_left: bool = False)

Country flag styling for tooltip items.

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.

Construct country flag styling for tooltip items.

Parameters:

Name Type Description Default
right_to_left bool

Enable right-to-left text direction.

False

Types#

TooltipItem module-attribute #

TooltipItems module-attribute #

TooltipItems = TooltipItem | list[TooltipItem]

TooltipItemFormatter module-attribute #

CountryTooltipItemStyling module-attribute #

CountryTooltipItemStyling = CountryTooltipItemStylingFlag