Metric

Metric comes in handy when presenting and visualizing the data for analytics.

Methods

Method
Description

setData(data: Array)

sets data for the metric

Triggers

Triggers allow you to launch certain actions based on different events.

On Init

Calls for an action on component initialization, e.g., page refresh

Working with a metric

Access calculated metric value

Metrics are great for calculations. With the help of a metric, you can easily calculate a sum or count of any specific values that you need. Sometimes you might need to use the value of the metric in other fields for further calculations. Instead of calculating them again, you can refer to the metric UI variable by referencing it in another field as {{ui.Metric.value.main}} or {{ui.Metric.value.additional}}, depending on which value you need to use.

Say you have a metric that displays the amount of logged hours for each employee and their hourly rate. You would also like to have a separate field to display the final salary of each employee.

This is how this can be achieved with the help of the metric UI variable:

  1. Add a Text field to the working area.

  2. Into the Text field of the menu, specify the formula: {{ ui.contactsMetric.value.main*ui.contactsMetric.value.additional }}

{{ ui.contactsMetric.value.main}}is the main field of the metric and represents the amount of logged hours;

{{ui.contactsMetric.value.additional }}is the additional field of the metric and represents the hourly rate

As an outcome, you will get the required amount.

Other examples

We have gathered some of the use cases with metric in the below guides:

Last updated

© 2024 UI Bakery