MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / formatNumber

Function formatNumber

src/components/formatTooltip.ts:16–26  ·  view source on GitHub ↗
(value: number)

Source from the content-addressed store, hash-verified

14}
15
16function formatNumber(value: number): string {
17 if (!Number.isFinite(value)) return EM_DASH;
18
19 // Normalize -0 to 0 for display stability.
20 const normalized = Object.is(value, -0) ? 0 : value;
21
22 // Maximum 2 decimal places, trim trailing zeros.
23 const fixed = normalized.toFixed(2);
24 const trimmed = fixed.replace(/\.?0+$/, '');
25 return trimmed === '-0' ? '0' : trimmed;
26}
27
28function resolveSeriesName(params: TooltipParams): string {
29 const trimmed = params.seriesName.trim();

Callers 3

formatCandlestickRowHtmlFunction · 0.70
formatTooltipItemFunction · 0.70
formatTooltipAxisFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected