Documentation / @ripl/charts / formatNumber
Function: formatNumber()
formatNumber(
value,precision?):string
Defined in: charts/src/core/options.ts:38
Formats a numeric value as a localized string, capping the precision at precision decimal places (default DEFAULT_NUMBER_PRECISION). Integers render without decimals; fractional values are rounded to at most precision places with trailing zeros stripped. Non-numeric values fall back to String(value). This is the shared entry point every chart uses so labels, axes, tooltips, and tick marks share one consistent precision cap.
Parameters
| Parameter | Type | Default value |
|---|---|---|
value | unknown | undefined |
precision | number | DEFAULT_NUMBER_PRECISION |
Returns
string