INNER CODE UNIT · TypeScript
getGraphPathRange
margelo/react-native-graph · src/CreateGraphPath.ts:56
export function getGraphPathRange(
points: GraphPoint[],
range?: GraphRange
): GraphPathRange {
const minValueX = range?.x?.min ?? points[0]?.date ?? new Date();
const maxValueX =
range?.x?.max ?? points[points.length - 1]?.date ?? new Date();
const minValueY =
range?.y?.min ??
points.reduce(
(prev, curr) => (curr.value < prev ? curr.value : prev),
Number.MAX_SAFE_INTEGER
);
const maxValueY =
range?.y?.max ??
points.reduce(
(prev, curr) => (curr.value > prev ? curr.value : prev),