Class MetricData<T>

Data for a particular region and metric, possibly including timeseries history.

Type Parameters

  • T = unknown

Hierarchy

  • MetricData

Constructors

Properties

_timeseries?: Timeseries<T>
currentValue: null | T

The current value of the metric or null if there is no available metric value for this region.

metric: Metric

The metric this data is for.

region: Region

The region this data is for.

Accessors

Methods

  • Ensures the metric data is boolean.

    Only strictly-boolean values are allowed (true, false). Use convertToBoolean() to coerce near-boolean values to boolean (e.g. "yes", 1, "True")

    Returns

    This MetricData cast to MetricData<boolean>.

    Returns MetricData<boolean>

  • Converts near-boolean metric data (e.g. "yes", "True", 1) to boolean.

    Throws an error if any data is not coercible to a boolean.

    Returns

    This MetricData with its data coerced to boolean, and cast to MetricData<boolean>

    Returns MetricData<boolean>

  • Formats the metric value for display purposes, using this metric's formatting logic.

    Returns

    The formatted value.

    Parameters

    • nullValueCopy: string = ""

      Optional copy to be used if the value is null, else an empty string will be used.

    Returns string

  • Uses this metric's grading logic or categories to color the currentValue.

    Returns

    The color associated with the metric's value.

    Returns string

  • Checks if timeseries data is available.

    Returns

    True if timeseries data was fetched for this metric. False means the metric is not timeseries-enabled or includeTimeseries was set to false when fetching the data.

    Returns boolean

  • Removes any empty (null) values from the timeseries, Ensures the remaining data is numeric, and returns a new Timeseries<number> with the data.

    Returns

    The timeseries cast to Timeseries<number>.

    Returns Timeseries<number>

  • Rounds the metric value to the appropriate number of significant digits based on this metric's formatting logic.

    Returns

    Rounded value.

    Returns null | number

Generated using TypeDoc