WebCola
Options
All
  • Public
  • Public/Protected
  • All
Menu

A Format Specifier

For details see: https://github.com/d3/d3-format#locale_format

Hierarchy

  • FormatSpecifier

Index

Properties

align

align: ">" | "<" | "^" | "="

Alignment used for format, as set by choosing one of the following

'>' - Forces the field to be right-aligned within the available space. (Default behavior). '<' - Forces the field to be left-aligned within the available space. '^' - Forces the field to be centered within the available space. '=' - Like '>', but with any sign and symbol to the left of any padding.

comma

comma: boolean

The comma (,) option enables the use of a group separator, such as a comma for thousands.

fill

fill: string

fill can be any character. The presence of a fill character is signaled by the align character following it.

precision

precision: number

Depending on the type, the precision either indicates the number of digits that follow the decimal point (types 'f' and '%'), or the number of significant digits (types ''​ (none), 'e', 'g', 'r', 's' and 'p'). If the precision is not specified, it defaults to 6 for all types except ''​ (none), which defaults to 12. Precision is ignored for integer formats (types 'b', 'o', 'd', 'x', 'X' and 'c').

See precisionFixed and precisionRound for help picking an appropriate precision

sign

sign: "-" | "+" | "(" | " "

The sign can be:

'-' - nothing for positive and a minus sign for negative. (Default behavior.) '+' - a plus sign for positive and a minus sign for negative. '(' - nothing for positive and parentheses for negative. ' '(space) - a space for positive and a minus sign for negative.

symbol

symbol: "$" | "#" | ""

The symbol can be:

'$' - apply currency symbols per the locale definition. '#' - for binary, octal, or hexadecimal notation, prefix by 0b, 0o, or 0x, respectively. ''(none) - no symbol.

type

type: "e" | "f" | "g" | "r" | "s" | "%" | "p" | "b" | "o" | "d" | "x" | "X" | "c" | "" | "n"

The available type values are:

'e' - exponent notation. 'f' - fixed point notation. 'g' - either decimal or exponent notation, rounded to significant digits. 'r' - decimal notation, rounded to significant digits. 's' - decimal notation with an SI prefix, rounded to significant digits. '%' - multiply by 100, and then decimal notation with a percent sign. 'p' - multiply by 100, round to significant digits, and then decimal notation with a percent sign. 'b' - binary notation, rounded to integer. 'o' - octal notation, rounded to integer. 'd' - decimal notation, rounded to integer. 'x' - hexadecimal notation, using lower-case letters, rounded to integer. 'X' - hexadecimal notation, using upper-case letters, rounded to integer. 'c' - converts the integer to the corresponding unicode character before printing. '' (none) - like g, but trim insignificant trailing zeros.

The type 'n' is also supported as shorthand for ',g'. For the 'g', 'n' and ​''(none) types, decimal notation is used if the resulting string would have precision or fewer digits; otherwise, exponent notation is used.

width

width: number | undefined

The width defines the minimum field width; if not specified, then the width will be determined by the content.

zero

zero: boolean

The zero (0) option enables zero-padding; this implicitly sets fill to 0 and align to =.

Methods

toString

  • toString(): string
  • Return the object as a specifier string.

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc