-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathLineGraphProps.ts
More file actions
79 lines (70 loc) · 1.95 KB
/
LineGraphProps.ts
File metadata and controls
79 lines (70 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import type React from 'react'
import type { ViewProps } from 'react-native'
export interface GraphPoint {
value: number
date: Date
}
interface BaseLineGraphProps extends ViewProps {
/**
* All points to be marked in the graph. Coordinate system will adjust to scale automatically.
*/
points: GraphPoint[]
/**
* Color of the graph line (path)
*/
color: string
/**
* The width of the graph line (path)
*
* @default 3
*/
lineThickness?: number
/**
* Enable the Fade-In Gradient Effect at the beginning of the Graph
*/
enableFadeInMask?: boolean
}
export type StaticLineGraphProps = BaseLineGraphProps & {
/* any static-only line graph props? */
}
export type AnimatedLineGraphProps = BaseLineGraphProps & {
/**
* Whether to enable Graph scrubbing/pan gesture.
*/
enablePanGesture?: boolean
/**
* The color of the selection dot when the user is panning the graph.
*/
selectionDotShadowColor?: string
/**
* Called for each point while the user is scrubbing/panning through the graph
*/
onPointSelected?: (point: GraphPoint) => void
/**
* Called once the user starts scrubbing/panning through the graph
*/
onGestureStart?: () => void
/**
* Called once the user stopped scrubbing/panning through the graph
*/
onGestureEnd?: () => void
/**
* The element that gets rendered above the Graph (usually the "max" point/value of the Graph)
*/
TopAxisLabel?: () => React.ReactElement | null
/**
* The element that gets rendered below the Graph (usually the "min" point/value of the Graph)
*/
BottomAxisLabel?: () => React.ReactElement | null
/**
* Hold duration for the graph gesture
*/
gestureHoldDuration?: number
/**
* Wether to reset or not the circle position when releasing the gesture
*/
resetPositionOnRelease?: boolean
}
export type LineGraphProps =
| ({ animated: true } & AnimatedLineGraphProps)
| ({ animated: false } & StaticLineGraphProps)