Metric-class: Metric widget

MetricR Documentation

Metric widget

Description

See metric().

Super class

Widget -> Metric

Public fields

formatter

⁠function(value)⁠ returning a string.

Active bindings

value

The value (reactive).

delta

The change shown next to the value (reactive).

Methods

Public methods

Inherited methods

Metric$new()

Create a metric. See metric().

Usage
Metric$new(
  label,
  value = NA,
  delta = NULL,
  format = NULL,
  id = NULL,
  classes = NULL,
  style = NULL
)
Arguments
label

Label.

value

Value.

delta

Change.

format

Formatter.

id, classes, style

See Widget.


Metric$default_style()

The built-in style.

Usage
Metric$default_style()

Metric$update()

Set the value (and optionally the delta).

Usage
Metric$update(value, delta = NULL)
Arguments
value

New value.

delta

New delta (NULL keeps none).


Metric$render()

Label, value and delta lines.

Usage
Metric$render()

Metric$clone()

The objects of this class are cloneable with this method.

Usage
Metric$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


termr documentation built on Oct. 21, 2026, 5:13 p.m.