Value Formatting

Thousands separators, currency, and compact notation

Format displayed numbers with thousands separators, compact notation, or currency symbols. Raw values are preserved for calculations; only display output is affected.

Format Options

Option Type Description
thousands boolean Add commas: 10001,000
compact boolean Use suffixes: 10001K, 10000001M
decimals number Decimal places (default: 0, or 1 if compact)
currency.symbol string Currency symbol: $, , etc.
currency.position string prefix (default) or suffix

Thousands Separators

Add commas to large numbers:

charts:
  revenue:
    type: dot
    title: Monthly Revenue
    format:
      thousands: true
    file: charts/revenue.csv
Monthly Revenue
  • value
2,345,6781,172,8390
JanuaryFebruaryMarch

Result: 12345671,234,567

Compact Notation

Shorten large numbers with K/M/B suffixes:

charts:
  users:
    type: stacked-bar
    title: User Growth
    format:
      compact: true
    file: charts/users.csv
User Growth
  • value
2022
1.5M
2023
2.8M
2024
4.2M

Examples:

  • 15001.5K
  • 20000002M
  • 35000000003.5B

Compact notation defaults to 1 decimal place. Override with decimals:

format:
  compact: true
  decimals: 0  # 1500 → 2K (rounded)

Currency Symbols

Add currency prefix or suffix:

charts:
  sales:
    type: dot
    title: Sales by Region
    format:
      thousands: true
      currency:
        symbol: "$"
    file: charts/sales.csv
Sales by Region
  • value
$142,000$71,000$0
NorthSouthEastWest

Result: 1234$1,234

Suffix Position

For currencies that follow the number (e.g., Euro in some locales):

format:
  thousands: true
  currency:
    symbol: "€"
    position: suffix

Result: 12341,234€

Decimal Places

Control precision with decimals:

format:
  decimals: 2

Works with all formatting options:

format:
  thousands: true
  decimals: 2
  currency:
    symbol: "$"
# 1234.5 → $1,234.50

Scatter Chart Formatting

Scatter charts support separate formatting for X and Y axes:

charts:
  scatter:
    type: scatter
    file: charts/data.csv
    format:
      x:
        thousands: true
      y:
        compact: true
        currency:
          symbol: "$"

This applies different formatting to each axis independently.

Combining Options

Multiple formatting options can be combined:

format:
  thousands: true      # Add commas
  compact: true        # Use K/M/B (overrides thousands for large numbers)
  decimals: 1          # One decimal place
  currency:
    symbol: "$"        # Dollar sign prefix

Note: When both thousands and compact are true, compact takes precedence for numbers large enough to abbreviate.