API Reference@grafana/dataguessDecimals

guessDecimals() function

guessDecimals() function

Tries to guess number of decimals needed to format a number

used for determining minimum decimals required to uniformly format a numric sequence, e.g. 10, 10.125, 10.25, 10.5

good for precisce increments: 0.125 -> 3 bad for arbitrary floats: 371.499999999999 -> 12

Signature

export declare function guessDecimals(num: number): number;

Import

import { guessDecimals } from '@grafana/data';

Parameters

ParameterTypeDescription
numnumber

Returns:

number