MAIDR Documentation - v3.46.2
    Preparing search index...

    Interface AxisFormat

    Configuration for formatting values on an axis.

    Two ways to specify formatting:

    1. function - Function body string (for custom logic)
    2. type - Format type specifier (for common patterns)
    // Using function string
    { "function": "return `$${Number(value).toFixed(2)}`" }
    // Using type specifier
    { "type": "currency", "decimals": 2 }
    interface AxisFormat {
        function?: string;
        type?: FormatType;
        decimals?: number;
        currency?: string;
        locale?: string;
        dateOptions?: DateTimeFormatOptions;
    }
    Index

    Properties

    function?: string

    Function body string for custom formatting. The function receives value as parameter and must return a string.

    // Currency formatting
    { "function": "return `$${Number(value).toFixed(2)}`" }
    // Date formatting
    { "function": "return new Date(value).toLocaleDateString('en-US')" }
    type?: FormatType

    Format type specifier for common formatting patterns. Use with decimals, currency, locale, dateOptions for customization.

    { "type": "currency", "currency": "USD", "decimals": 2 }
    { "type": "percent", "decimals": 1 }
    { "type": "date", "dateOptions": { "month": "short", "day": "numeric" } }
    decimals?: number

    Number of decimal places for numeric formatters. Used with: currency, percent, fixed, number, scientific

    varies by type
    
    currency?: string

    ISO 4217 currency code for currency formatter.

    'USD'
    
    locale?: string

    BCP 47 locale string for locale-aware formatters. Used with: currency, number, date

    'en-US'
    
    dateOptions?: DateTimeFormatOptions

    Options for Intl.DateTimeFormat when using date type.

    { "month": "short", "day": "numeric" } // "Jan 15"
    { "year": "numeric", "month": "long" } // "January 2024"