ExTeal.Metric behaviour (ExTeal v0.21.0) View Source
Describes the behaviour of a metric with specific callbacks for building a base result, calculating the values, applying then and returning the result
Link to this section Summary
Callbacks
Define the options that are passed as a metrics options map as it's returned as part of a metric result.
The name of the component to mount in the ux responsible for rendering the content
Define the range to render by default for a metric.
A string representing how a value is formatted before being displayed by the
numbro library. Defaults to 0,0
Only display the metric on the detail page of a specific resource.
Only display the metric on the index page of a specific resource.
Options that are serialized into the configuration of a metric card.
A string to prepend to any displayed value on the metric card. For example: $
Define which ranges are available for a metric.
A string to appended to any displayed value on the metric card. For example: °
Set the title displayed at the top of the card, defaults to a humanized title of the module
Explicitly set the uri used to fetch the details of a card.
Set the width of card that displays the metric. Defaults to 1/3. 1/3 and full are the only allowed values
Link to this section Types
Specs
Specs
unit() :: :minute | :hour | :day | :week | :month | :year
Link to this section Callbacks
Specs
chart_options() :: map()
Define the options that are passed as a metrics options map as it's returned as part of a metric result.
Specs
component() :: String.t()
The name of the component to mount in the ux responsible for rendering the content
Specs
date_field() :: atom()
Specs
date_field_type() :: :naive_datetime | :utc_datetime
Specs
default_range() :: range()
Define the range to render by default for a metric.
Specs
format() :: String.t()
A string representing how a value is formatted before being displayed by the
numbro library. Defaults to 0,0
Specs
multiple_results() :: boolean()
Specs
only_on_detail(Plug.Conn.t()) :: boolean()
Only display the metric on the detail page of a specific resource.
Specs
only_on_index(Plug.Conn.t()) :: boolean()
Only display the metric on the index page of a specific resource.
Specs
options(Plug.Conn.t()) :: map()
Options that are serialized into the configuration of a metric card.
Used as part of a dashboard or card list on a resource index or detail page.
Specs
prefix() :: String.t() | nil
A string to prepend to any displayed value on the metric card. For example: $
Specs
ranges() :: [range()]
Define which ranges are available for a metric.
Defaults to Metric.default_ranges/0
but can be overriden per metric.
Specs
suffix() :: String.t() | nil
A string to appended to any displayed value on the metric card. For example: °
Specs
title() :: String.t()
Set the title displayed at the top of the card, defaults to a humanized title of the module
Specs
uri() :: String.t()
Explicitly set the uri used to fetch the details of a card.
Specs
width() :: String.t()
Set the width of card that displays the metric. Defaults to 1/3. 1/3 and full are the only allowed values
Link to this section Functions
Specs
default_ranges() :: [range()]