UNPKG

victory-native

Version:

A charting library for React Native with a focus on performance and customization.

30 lines (26 loc) 563 B
import type { Scale } from "../../types"; import { downsampleTicks } from "../../utils/tickHelpers"; export const getXAxisTicks = ({ isNumericalData, ix, tickCount, tickValues, xScale, }: { isNumericalData: boolean; ix: unknown[]; tickCount: number; tickValues?: number[]; xScale: Pick<Scale, "ticks">; }) => { if (tickValues) { return downsampleTicks(tickValues, tickCount); } if (!isNumericalData) { return downsampleTicks( ix.map((_, index) => index), tickCount, ); } return xScale.ticks(tickCount); };