UNPKG

react-native-chart-kit

Version:

Beautiful React Native charts for dashboards, reports, and data-rich mobile apps.

82 lines 3.56 kB
import type { ChartXValue } from "../../../core/index"; import type { LineChartSelectablePoint, LineChartSelectedSeriesItem } from "./selection"; export type LineChartInteractionMode = "none" | "tap" | "scrub"; export type LineChartSelectionPersistence = "persist" | "whileActive" | "none"; export type LineChartSelectSeriesItem<TPoint extends LineChartSelectablePoint = LineChartSelectablePoint> = { key: string; label: string; color: string; value: number | null | undefined; formattedValue: string; point: TPoint; }; export type LineChartSelectEvent<TData = unknown, TPoint extends LineChartSelectablePoint = LineChartSelectablePoint> = { index: number; x: ChartXValue; xLabel: string; position: { x: number; y: number; }; series: Array<LineChartSelectSeriesItem<TPoint>>; raw?: TData; }; export type LineChartDeselectEvent = { reason: "outsidePress" | "gestureEnd" | "programmatic"; }; export type LineChartInteractionConfig<TData = unknown> = { mode?: LineChartInteractionMode; selectionPersistence?: LineChartSelectionPersistence; deselectOnOutsidePress?: boolean; onSelect?: (event: LineChartSelectEvent<TData>) => void; onDeselect?: (event: LineChartDeselectEvent) => void; onGestureStart?: () => void; onGestureEnd?: () => void; }; export type LineChartInteraction<TData = unknown> = LineChartInteractionMode | LineChartInteractionConfig<TData>; export type ResolvedLineChartInteractionConfig<TData = unknown> = { mode: LineChartInteractionMode; selectionPersistence: LineChartSelectionPersistence; deselectOnOutsidePress: boolean; onSelect?: (event: LineChartSelectEvent<TData>) => void; onDeselect?: (event: LineChartDeselectEvent) => void; onGestureStart?: () => void; onGestureEnd?: () => void; }; export type LineChartInteractionPoint<TData = unknown> = { dataIndex: number; x: number; xValue: ChartXValue; xLabel: string; raw?: TData; }; export type LineChartInteractionBounds = { x: number; y: number; width: number; height: number; }; export declare const normalizeLineChartSelectedIndex: (selectedIndex: number | undefined) => number | undefined; export declare const getLineChartInteractionConfig: <TData>(interaction: LineChartInteraction<TData> | undefined) => ResolvedLineChartInteractionConfig<TData>; export declare const isLineChartInteractionEnabled: <TData>(config: ResolvedLineChartInteractionConfig<TData>) => boolean; export declare const isLineChartInteractionInBounds: ({ bounds, locationX, locationY, touchSlop }: { bounds: LineChartInteractionBounds; locationX: number; locationY: number; touchSlop?: number; }) => boolean; export declare const getLineChartVisibleInteractionBounds: ({ bounds, scrollable, viewportWidth }: { bounds: LineChartInteractionBounds; scrollable: boolean; viewportWidth: number; }) => LineChartInteractionBounds; export declare const getNearestLineChartInteractionIndex: ({ locationX, points }: { locationX: number; points: Array<LineChartInteractionPoint>; }) => number | undefined; export declare const buildLineChartSelectEvent: <TData, TPoint extends LineChartSelectablePoint>({ interactionPoints, selectedDataIndex, selectedSeries }: { interactionPoints: Array<LineChartInteractionPoint<TData>>; selectedDataIndex: number; selectedSeries: Array<LineChartSelectedSeriesItem<TPoint>>; }) => LineChartSelectEvent<TData, TPoint> | undefined; //# sourceMappingURL=interaction.d.ts.map