react-native-stonk-charts
Version:
A beautiful, performant chart library for React Native. Fork of react-native-wagmi-charts with Reanimated v4 support.
10 lines (8 loc) • 331 B
text/typescript
import type { TCandle } from '../types';
export function getDomain(rows: TCandle[]): [min: number, max: number] {
'worklet';
const values = rows.map(({ high, low }) => [high, low]).flat();
const min = Math.min(...values);
const max = Math.max(...values);
return [min - (max - min) * 0.025, max + (max - min) * 0.025];
}