react-native-graph-plus
Version:
📈 Beautiful, high-performance Graphs and Charts for React Native +
54 lines (53 loc) • 1.85 kB
TypeScript
import { SkPath } from '@shopify/react-native-skia';
import type { GraphPoint, GraphRange } from './LineGraphProps';
export interface GraphXRange {
min: Date;
max: Date;
}
export interface GraphYRange {
min: number;
max: number;
}
export interface GraphPathRange {
x: GraphXRange;
y: GraphYRange;
}
declare type GraphPathConfig = {
/**
* Graph Points to use for the Path. Will be normalized and centered.
*/
pointsInRange: GraphPoint[];
/**
* Optional Padding (left, right) for the Graph to correctly round the Path.
*/
horizontalPadding: number;
/**
* Optional Padding (top, bottom) for the Graph to correctly round the Path.
*/
verticalPadding: number;
/**
* Height of the Canvas (Measured with onLayout)
*/
canvasHeight: number;
/**
* Width of the Canvas (Measured with onLayout)
*/
canvasWidth: number;
/**
* Range of the graph's x and y-axis
*/
range: GraphPathRange;
};
export declare function getGraphPathRange(points: GraphPoint[], range?: GraphRange): GraphPathRange;
export declare const getXPositionInRange: (date: Date, xRange: GraphXRange) => number;
export declare const getXInRange: (width: number, date: Date, xRange: GraphXRange) => number;
export declare const getYPositionInRange: (value: number, yRange: GraphYRange) => number;
export declare const getYInRange: (height: number, value: number, yRange: GraphYRange) => number;
export declare const getPointsInRange: (allPoints: GraphPoint[], range: GraphPathRange) => GraphPoint[];
declare type GraphPathWithGradient = {
path: SkPath;
gradientPath: SkPath;
};
export declare function createGraphPath(props: GraphPathConfig): SkPath;
export declare function createGraphPathWithGradient(props: GraphPathConfig): GraphPathWithGradient;
export {};