UNPKG

react-native-wagmi-charts

Version:

A sweet candlestick chart for React Native

11 lines (9 loc) 371 B
import type { TCandle } from '../types'; export function getDomain(rows: TCandle[]): [min: number, max: number] { 'worklet'; if (rows.length === 0) return [0, 0]; 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]; }