4 min read

displayNumberAsStat Documentation

Purpose

The node is designed to format and display a numerical value as a statistical component. This is particularly useful in analytics dashboards where users need to visualize key performance indicators (KPIs) or other numerical data in a concise and readable format. It allows for customizable titles, subtitles, footers, and units, enhancing the overall user experience in interpreting statistical data.

Settings

1. Title

2. Subtitle

4. Value Input

5. Units

6. Precision

How It Works

The node performs the following steps:

  1. It retrieves various input values from the inputs object, which includes the title, subtitle, footer text, numerical value, units, and precision.
  2. It ensures the precision is a non-negative integer by taking the maximum of 0 and converting the provided precision input.
  3. The core numerical value is formatted to the specified precision using Number.toFixed().
  4. The formatted number is combined with its units to form a complete representation (e.g., "123.45 kg").
  5. Finally, the function returns a configuration object for the statistical component that includes all the formatted details and any additional configurations passed in.

Data Expectations

The function expects input data in a structured format resembling:

json
{
  "inputs": {
    "title": "Total Sales",
    "subtitle": "As of Q1 2023",
    "footer": "Source: Internal Database",
    "input1": 12345.678,
    "units": "USD",
    "precision": 2
  },
  "config": {}
}

Where config may include additional layout or display settings for integration within the overall analytics platform.

Use Cases & Examples

Use Cases

  1. Financial Reporting: A finance team needs to display total sales for a quarter along with relevant subtitles for context.
  2. User Metrics Tracking: A product team analyzes the number of active users versus the previous month and seeks clarity through statistical display.
  3. Sales Metric Improvement: Marketing teams display current conversion rates from a campaign, requiring precision to track minute changes in performance.

Example Configuration

Scenario: Display Total Sales for a Quarter

A finance team wants to visualize the total sales reported in Q1, making it clear that the number is in USD and rounding to two decimal places.

Configuration Data:

json
{
  "inputs": {
    "title": "Total Sales",
    "subtitle": "As of Q1 2023",
    "footer": "Source: Internal Database",
    "input1": 15320.548,
    "units": "USD",
    "precision": 2
  },
  "config": {
    "tile_type": "stat"
  }
}

Expected Output:

Through this configuration, the finance team can present a neat and informative statistical tile on their analytics dashboard, making performance metrics easily interpretable at a glance.