Components Interactions Examples Tutorials API FAQ
Options
Menu

Module Formatters

Index

Functions

currency

  • currency(precision?: number, symbol?: string, prefix?: boolean): function
  • Creates a formatter for currency values.

    Parameters

    • Optional precision: number
    • Optional symbol: string
    • Optional prefix: boolean

    Returns function

    A formatter for currency values.

      • (d: any): string
      • Parameters

        • d: any

        Returns string

fixed

  • fixed(precision?: number): function
  • Creates a formatter that displays exactly [precision] decimal places.

    Parameters

    • Optional precision: number

    Returns function

    A formatter that displays exactly [precision] decimal places.

      • (d: any): string
      • Parameters

        • d: any

        Returns string

general

  • general(maxNumberOfDecimalPlaces?: number): function
  • Creates a formatter that formats numbers to show no more than [maxNumberOfDecimalPlaces] decimal places. All other values are stringified.

    Parameters

    • Optional maxNumberOfDecimalPlaces: number

    Returns function

    A formatter for general values.

      • (d: any): string
      • Parameters

        • d: any

        Returns string

identity

  • identity(): function
  • Creates a formatter that stringifies its input.

    Returns function

    A formatter that stringifies its input.

      • (d: any): string
      • Parameters

        • d: any

        Returns string

multiTime

  • multiTime(): function
  • Creates a multi time formatter that displays dates.

    Returns function

    A formatter for time/date values.

      • (d: any): string
      • Parameters

        • d: any

        Returns string

percentage

  • percentage(precision?: number): function
  • Creates a formatter for percentage values. Multiplies the input by 100 and appends "%".

    Parameters

    • Optional precision: number

    Returns function

    A formatter for percentage values.

      • (d: any): string
      • Parameters

        • d: any

        Returns string

shortScale

  • shortScale(precision?: number): function
  • Creates a formatter for values that displays abbreviated values and uses standard short scale suffixes

    • K - thousands - 10 ^ 3
    • M - millions - 10 ^ 6
    • B - billions - 10 ^ 9
    • T - trillions - 10 ^ 12
    • Q - quadrillions - 10 ^ 15

    Numbers with a magnitude outside of (10 ^ (-precision), 10 ^ 15) are shown using scientific notation to avoid creating extremely long decimal strings.

    Parameters

    • Optional precision: number

    Returns function

    A formatter with short scale formatting

      • (num: number): string
      • Parameters

        • num: number

        Returns string

siSuffix

  • siSuffix(numberOfSignificantFigures?: number): function
  • Creates a formatter for values that displays [numberOfSignificantFigures] significant figures and puts SI notation.

    Parameters

    • Optional numberOfSignificantFigures: number

    Returns function

    A formatter for SI values.

      • (d: any): string
      • Parameters

        • d: any

        Returns string

time

Generated using TypeDoc