Skip to content
EliteChart

formatVolume

Documentation


Documentation / @elitechart/core / formatVolume

code
function formatVolume(vol): string;

Defined in: renderer/ohlcv-legend.ts:99

Format a volume value compactly: 12_345 → "12.35K", 1_234_567 → "1.23M". Keeps the strip visually short regardless of volume magnitude.

Parameters

vol

number

Returns

string

Example

code
import { formatVolume } from '@elitechart/core';
formatVolume(12_345);     // '12.35K'
formatVolume(1_234_567);  // '1.23M'