Skip to content

metric class

A control that provides a visualization for a specific metric.

Methods

__init__()

__init__(
    value=None,
    type="circular",
    min=0,
    max=100,
    delta=None,
    delta_color=None,
    title=None,
    negative_delta_color=None,
    threshold=None,
    show_value=True,
    format=None,
    delta_format=None,
    bar_color=None,
    color_map=None,
    width="20vw",
    height="20vh",
    layout=None,
    template=None,
    id=None,
    properties=None,
    class_name=None,
    hover_text=None,
) -> None

Create a new metric element.

Parameters:

Name Type Description Default

value

Union[int,float]
dynamic

The value to represent.

None

type

str

The type of the gauge.
Possible values are:

  • "none"
  • "circular"
  • "linear"

Setting this value to "none" remove the gauge.

circular

min

Union[int, float]

The minimum value of this metric control's gauge.

0

max

Union[int, float]

The maximum value of this metric control's gauge.

100

delta

Union[int,float]
dynamic

The delta value to display.

None

delta_color

str

The color that is used to display the value of the delta property.
If negative_delta_color is set, then this property applies for positive values of delta only.
If this property is set to "invert", then values for delta are represented with the color used for negative values if delta is positive and delta is represented with the color used for positive values if it is negative.

None

title

str

The title of the metric.

None

negative_delta_color

str

If set, this represents the color to be used when the value of delta is negative (or positive if delta_color is set to "invert").

None

threshold

Union[int,float]
dynamic

The threshold value to display.

None

show_value

bool

If set to False, the value is not displayed.

True

format

str

The format to use when displaying the value.
This uses the printf syntax.

None

delta_format

str

The format to use when displaying the delta value.
This uses the printf syntax.

None

bar_color

str

The color of the bar in the gauge.

None

color_map

dict

Indicates what colors should be used for different ranges of the metric. The color_map's keys represent the lower bound of each range, which is a number, while the values represent the color for that range.
If the value associated with a key is set to None, the corresponding range is not assigned any color.

None

width

Union[str, number]

The width of the metric control, in CSS units

20vw

height

Union[str, number]

The height of the metric control, in CSS units

20vh

layout

dict[str, Any]
dynamic

The plotly.js compatible layout object.

None

template

dict

The Plotly layout template.

None

id

str

The identifier that is assigned to the rendered HTML component.

None

properties

dict[str, Any]

Bound to a dictionary that contains additional properties for this element.

None

class_name

str
dynamic

The list of CSS class names that are associated with the generated HTML Element.
These class names are added to the default taipy-metric class name.

None

hover_text

str
dynamic

The information that is displayed when the user hovers over this element.

None