gifted-charts-core 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/BarChart/index.ts +1 -0
- package/src/BarChart/types.ts +18 -8
- package/src/LineChart/LineChartBiColor.ts +12 -4
- package/src/LineChart/index.ts +4 -3
- package/src/LineChart/types.ts +6 -5
- package/src/components/BarAndLineChartsWrapper/index.ts +9 -3
- package/src/utils/constants.ts +75 -72
- package/src/utils/types.ts +7 -6
package/package.json
CHANGED
package/src/BarChart/index.ts
CHANGED
package/src/BarChart/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ColorValue, GestureResponderEvent} from
|
|
2
|
-
import {yAxisSides} from
|
|
1
|
+
import { ColorValue, GestureResponderEvent } from "react-native";
|
|
2
|
+
import { yAxisSides } from "../utils/constants";
|
|
3
3
|
import {
|
|
4
4
|
CurveType,
|
|
5
5
|
Pointer,
|
|
@@ -7,11 +7,12 @@ import {
|
|
|
7
7
|
RulesConfig,
|
|
8
8
|
referenceConfigType,
|
|
9
9
|
secondaryYAxisType,
|
|
10
|
-
} from
|
|
11
|
-
import {Component, ReactNode} from
|
|
10
|
+
} from "../utils/types";
|
|
11
|
+
import { Component, ReactNode } from "react";
|
|
12
12
|
|
|
13
13
|
export type stackDataItem = {
|
|
14
14
|
onPress?: any;
|
|
15
|
+
onLongPress?: any;
|
|
15
16
|
label?: String;
|
|
16
17
|
barWidth?: number;
|
|
17
18
|
spacing?: number;
|
|
@@ -75,6 +76,7 @@ export type StackedBarChartPropsType = {
|
|
|
75
76
|
data?: any;
|
|
76
77
|
barWidth?: number;
|
|
77
78
|
onPress?: Function;
|
|
79
|
+
onLongPress?: Function;
|
|
78
80
|
|
|
79
81
|
rotateLabel?: boolean;
|
|
80
82
|
showXAxisIndices: boolean;
|
|
@@ -90,7 +92,10 @@ export type StackedBarChartPropsType = {
|
|
|
90
92
|
barBorderTopRightRadius?: number;
|
|
91
93
|
barBorderBottomLeftRadius?: number;
|
|
92
94
|
barBorderBottomRightRadius?: number;
|
|
93
|
-
barInnerComponent?: (
|
|
95
|
+
barInnerComponent?: (
|
|
96
|
+
item?: barDataItem | stackDataItem,
|
|
97
|
+
index?: number
|
|
98
|
+
) => ReactNode;
|
|
94
99
|
stackBorderRadius?: number;
|
|
95
100
|
stackBorderTopLeftRadius?: number;
|
|
96
101
|
stackBorderTopRightRadius?: number;
|
|
@@ -219,7 +224,7 @@ export type BarChartPropsType = {
|
|
|
219
224
|
|
|
220
225
|
disableScroll?: boolean;
|
|
221
226
|
showScrollIndicator?: boolean;
|
|
222
|
-
indicatorColor?:
|
|
227
|
+
indicatorColor?: "black" | "default" | "white";
|
|
223
228
|
roundedTop?: boolean;
|
|
224
229
|
roundedBottom?: boolean;
|
|
225
230
|
disablePress?: boolean;
|
|
@@ -274,11 +279,15 @@ export type BarChartPropsType = {
|
|
|
274
279
|
patternId?: String;
|
|
275
280
|
barMarginBottom?: number;
|
|
276
281
|
onPress?: Function;
|
|
282
|
+
onLongPress?: Function;
|
|
277
283
|
renderTooltip?: Function;
|
|
278
284
|
leftShiftForTooltip?: number;
|
|
279
285
|
leftShiftForLastIndexTooltip?: number;
|
|
280
286
|
barStyle?: object;
|
|
281
|
-
barInnerComponent?: (
|
|
287
|
+
barInnerComponent?: (
|
|
288
|
+
item?: stackDataItem | barDataItem,
|
|
289
|
+
index?: number
|
|
290
|
+
) => ReactNode;
|
|
282
291
|
|
|
283
292
|
secondaryData?: Array<barDataItem>;
|
|
284
293
|
secondaryYAxis?: secondaryYAxisType | boolean;
|
|
@@ -288,6 +297,7 @@ export type BarChartPropsType = {
|
|
|
288
297
|
|
|
289
298
|
onEndReached?: () => void;
|
|
290
299
|
onStartReached?: () => void;
|
|
300
|
+
endReachedOffset?: number;
|
|
291
301
|
};
|
|
292
302
|
type lineConfigType = {
|
|
293
303
|
initialSpacing?: number;
|
|
@@ -364,6 +374,7 @@ type sectionType = {
|
|
|
364
374
|
export type barDataItem = {
|
|
365
375
|
value: number;
|
|
366
376
|
onPress?: any;
|
|
377
|
+
onLongPress?: any;
|
|
367
378
|
frontColor?: ColorValue;
|
|
368
379
|
sideColor?: ColorValue;
|
|
369
380
|
topColor?: ColorValue;
|
|
@@ -546,4 +557,3 @@ export type animatedBarPropTypes = {
|
|
|
546
557
|
item: any;
|
|
547
558
|
index: number;
|
|
548
559
|
};
|
|
549
|
-
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
AxesAndRulesDefaults,
|
|
4
|
+
LineDefaults,
|
|
5
|
+
chartTypes,
|
|
6
|
+
} from "../utils/constants";
|
|
7
|
+
import {
|
|
8
|
+
getAxesAndRulesProps,
|
|
9
|
+
getExtendedContainerHeightWithPadding,
|
|
10
|
+
} from "../utils";
|
|
4
11
|
import { bicolorLineDataItem } from "./types";
|
|
5
12
|
import { BarAndLineChartsWrapperTypes } from "../utils/types";
|
|
6
13
|
|
|
@@ -464,7 +471,7 @@ export const useLineChartBiColor = (props) => {
|
|
|
464
471
|
lineData2: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
465
472
|
lineBehindBars: false,
|
|
466
473
|
points: pointsArray,
|
|
467
|
-
points2:
|
|
474
|
+
points2: "", // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
468
475
|
arrowPoints: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
469
476
|
remainingScrollViewProps: {},
|
|
470
477
|
|
|
@@ -494,7 +501,8 @@ export const useLineChartBiColor = (props) => {
|
|
|
494
501
|
pointerIndex: 0,
|
|
495
502
|
pointerX: 0,
|
|
496
503
|
pointerY: 0,
|
|
497
|
-
|
|
504
|
+
endReachedOffset: props.endReachedOffset ?? LineDefaults.endReachedOffset,
|
|
505
|
+
};
|
|
498
506
|
|
|
499
507
|
return {
|
|
500
508
|
toggle,
|
package/src/LineChart/index.ts
CHANGED
|
@@ -1698,7 +1698,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
1698
1698
|
setPointerY5(y5);
|
|
1699
1699
|
};
|
|
1700
1700
|
|
|
1701
|
-
const barAndLineChartsWrapperProps:BarAndLineChartsWrapperTypes = {
|
|
1701
|
+
const barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes = {
|
|
1702
1702
|
chartType: chartTypes.LINE,
|
|
1703
1703
|
containerHeight,
|
|
1704
1704
|
noOfSectionsBelowXAxis,
|
|
@@ -1734,7 +1734,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
1734
1734
|
lineData2: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1735
1735
|
lineBehindBars: false,
|
|
1736
1736
|
points,
|
|
1737
|
-
points2:
|
|
1737
|
+
points2: "", // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1738
1738
|
arrowPoints: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1739
1739
|
|
|
1740
1740
|
//horizSectionProps-
|
|
@@ -1764,7 +1764,8 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
1764
1764
|
|
|
1765
1765
|
onEndReached: props.onEndReached,
|
|
1766
1766
|
onStartReached: props.onStartReached,
|
|
1767
|
-
|
|
1767
|
+
endReachedOffset: props.endReachedOffset ?? LineDefaults.endReachedOffset,
|
|
1768
|
+
};
|
|
1768
1769
|
|
|
1769
1770
|
return {
|
|
1770
1771
|
curvature,
|
package/src/LineChart/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ColorValue} from
|
|
2
|
-
import {yAxisSides} from
|
|
1
|
+
import { ColorValue } from "react-native";
|
|
2
|
+
import { yAxisSides } from "../utils/constants";
|
|
3
3
|
import {
|
|
4
4
|
CurveType,
|
|
5
5
|
DataSet,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
referenceConfigType,
|
|
14
14
|
secondaryLineConfigType,
|
|
15
15
|
secondaryYAxisType,
|
|
16
|
-
} from
|
|
16
|
+
} from "../utils/types";
|
|
17
17
|
|
|
18
18
|
export type LineChartPropsType = {
|
|
19
19
|
height?: number;
|
|
@@ -121,7 +121,7 @@ export type LineChartPropsType = {
|
|
|
121
121
|
disableScroll?: boolean;
|
|
122
122
|
pointerConfig?: Pointer;
|
|
123
123
|
showScrollIndicator?: boolean;
|
|
124
|
-
indicatorColor?:
|
|
124
|
+
indicatorColor?: "black" | "default" | "white";
|
|
125
125
|
|
|
126
126
|
//Indices
|
|
127
127
|
|
|
@@ -318,6 +318,7 @@ export type LineChartPropsType = {
|
|
|
318
318
|
|
|
319
319
|
onEndReached?: () => void;
|
|
320
320
|
onStartReached?: () => void;
|
|
321
|
+
endReachedOffset?: number;
|
|
321
322
|
};
|
|
322
323
|
|
|
323
324
|
export type lineDataItem = {
|
|
@@ -489,7 +490,7 @@ export type LineChartBicolorPropsType = {
|
|
|
489
490
|
|
|
490
491
|
disableScroll?: boolean;
|
|
491
492
|
showScrollIndicator?: boolean;
|
|
492
|
-
indicatorColor?:
|
|
493
|
+
indicatorColor?: "black" | "default" | "white";
|
|
493
494
|
|
|
494
495
|
//Indices
|
|
495
496
|
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
2
|
import { AxesAndRulesDefaults, BarDefaults } from "../../utils/constants";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
BarAndLineChartsWrapperTypes,
|
|
5
|
+
horizSectionPropTypes,
|
|
6
|
+
} from "../../utils/types";
|
|
4
7
|
|
|
5
|
-
export const useBarAndLineChartsWrapper = (
|
|
8
|
+
export const useBarAndLineChartsWrapper = (
|
|
9
|
+
props: BarAndLineChartsWrapperTypes
|
|
10
|
+
) => {
|
|
6
11
|
const {
|
|
7
12
|
chartType,
|
|
8
13
|
containerHeight,
|
|
@@ -52,6 +57,7 @@ export const useBarAndLineChartsWrapper = (props) => {
|
|
|
52
57
|
pointerY,
|
|
53
58
|
|
|
54
59
|
scrollEventThrottle,
|
|
60
|
+
endReachedOffset,
|
|
55
61
|
} = props;
|
|
56
62
|
|
|
57
63
|
let yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop;
|
|
@@ -313,7 +319,7 @@ export const useBarAndLineChartsWrapper = (props) => {
|
|
|
313
319
|
const isCloseToEnd = ({ layoutMeasurement, contentOffset, contentSize }) => {
|
|
314
320
|
return (
|
|
315
321
|
layoutMeasurement.width + contentOffset.x >=
|
|
316
|
-
contentSize.width - initialSpacing
|
|
322
|
+
contentSize.width - initialSpacing - endReachedOffset
|
|
317
323
|
);
|
|
318
324
|
};
|
|
319
325
|
|
package/src/utils/constants.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {defaultLineConfigType} from
|
|
2
|
-
import {CurveType, EdgePosition, RuleTypes} from
|
|
3
|
-
import {Dimensions} from
|
|
4
|
-
import {FontStyle} from
|
|
1
|
+
import { defaultLineConfigType } from "../BarChart/types";
|
|
2
|
+
import { CurveType, EdgePosition, RuleTypes } from "./types";
|
|
3
|
+
import { Dimensions } from "react-native";
|
|
4
|
+
import { FontStyle } from "react-native-svg";
|
|
5
5
|
|
|
6
6
|
// Global
|
|
7
7
|
|
|
@@ -11,12 +11,13 @@ export enum chartTypes {
|
|
|
11
11
|
LINE_BI_COLOR,
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const screenWidth = Dimensions.get(
|
|
14
|
+
export const screenWidth = Dimensions.get("window").width;
|
|
15
15
|
|
|
16
16
|
const defaultCurvature = 0.2;
|
|
17
17
|
const defaultCurveType = CurveType.CUBIC;
|
|
18
18
|
const defaultAnimationDuration = 800;
|
|
19
19
|
const defaultScrollEventThrottle = 0;
|
|
20
|
+
const defaultEndReachedOffset = 80;
|
|
20
21
|
|
|
21
22
|
// Bar and Line chart Specific
|
|
22
23
|
|
|
@@ -31,38 +32,38 @@ export enum loc {
|
|
|
31
32
|
DOWN,
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
export const SEGMENT_START =
|
|
35
|
-
export const SEGMENT_END =
|
|
36
|
-
export const RANGE_ENTER =
|
|
37
|
-
export const RANGE_EXIT =
|
|
38
|
-
export const STOP =
|
|
35
|
+
export const SEGMENT_START = "segmentStart";
|
|
36
|
+
export const SEGMENT_END = "segmentEnd";
|
|
37
|
+
export const RANGE_ENTER = "RangeEnter";
|
|
38
|
+
export const RANGE_EXIT = "RangeExit";
|
|
39
|
+
export const STOP = "stop";
|
|
39
40
|
|
|
40
41
|
export const ruleTypes: RuleTypes = {
|
|
41
|
-
SOLID:
|
|
42
|
-
DASHED:
|
|
43
|
-
DOTTED:
|
|
42
|
+
SOLID: "solid",
|
|
43
|
+
DASHED: "dashed",
|
|
44
|
+
DOTTED: "dotted",
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
export const AxesAndRulesDefaults = {
|
|
47
48
|
yAxisSide: yAxisSides.LEFT,
|
|
48
|
-
yAxisColor:
|
|
49
|
+
yAxisColor: "black",
|
|
49
50
|
yAxisExtraHeight: 0,
|
|
50
51
|
yAxisThickness: 1,
|
|
51
52
|
trimYAxisAtTop: false,
|
|
52
53
|
overflowTop: 0,
|
|
53
|
-
xAxisColor:
|
|
54
|
+
xAxisColor: "black",
|
|
54
55
|
xAxisThickness: 1,
|
|
55
56
|
xAxisType: ruleTypes.SOLID,
|
|
56
57
|
xAxisTextNumberOfLines: 1,
|
|
57
58
|
xAxisLabelsVerticalShift: 0,
|
|
58
59
|
dashWidth: 4,
|
|
59
60
|
dashGap: 8,
|
|
60
|
-
backgroundColor:
|
|
61
|
+
backgroundColor: "transparent",
|
|
61
62
|
|
|
62
63
|
hideRules: false,
|
|
63
64
|
rulesType: ruleTypes.DASHED,
|
|
64
65
|
rulesThickness: 1,
|
|
65
|
-
rulesColor:
|
|
66
|
+
rulesColor: "lightgray",
|
|
66
67
|
rulesConfigArray: [],
|
|
67
68
|
|
|
68
69
|
rotateLabel: false,
|
|
@@ -70,12 +71,12 @@ export const AxesAndRulesDefaults = {
|
|
|
70
71
|
showYAxisIndices: false,
|
|
71
72
|
yAxisIndicesHeight: 2,
|
|
72
73
|
yAxisIndicesWidth: 4,
|
|
73
|
-
yAxisIndicesColor:
|
|
74
|
+
yAxisIndicesColor: "black",
|
|
74
75
|
|
|
75
76
|
showXAxisIndices: false,
|
|
76
77
|
xAxisIndicesHeight: 2,
|
|
77
78
|
xAxisIndicesWidth: 4,
|
|
78
|
-
xAxisIndicesColor:
|
|
79
|
+
xAxisIndicesColor: "black",
|
|
79
80
|
|
|
80
81
|
hideOrigin: false,
|
|
81
82
|
hideYAxisText: false,
|
|
@@ -83,8 +84,8 @@ export const AxesAndRulesDefaults = {
|
|
|
83
84
|
|
|
84
85
|
showVerticalLines: false,
|
|
85
86
|
verticalLinesThickness: 1,
|
|
86
|
-
verticalLinesColor:
|
|
87
|
-
verticalLinesStrokeDashArray:
|
|
87
|
+
verticalLinesColor: "lightgray",
|
|
88
|
+
verticalLinesStrokeDashArray: "",
|
|
88
89
|
verticalLinesShift: 0,
|
|
89
90
|
verticalLinesZIndex: -1,
|
|
90
91
|
verticalLinesSpacing: 0,
|
|
@@ -109,8 +110,8 @@ export const defaultArrowConfig = {
|
|
|
109
110
|
length: 10,
|
|
110
111
|
width: 10,
|
|
111
112
|
strokeWidth: 1,
|
|
112
|
-
strokeColor:
|
|
113
|
-
fillColor:
|
|
113
|
+
strokeColor: "black",
|
|
114
|
+
fillColor: "none",
|
|
114
115
|
showArrowBase: true,
|
|
115
116
|
};
|
|
116
117
|
|
|
@@ -120,9 +121,9 @@ export const BarDefaults = {
|
|
|
120
121
|
barWidth: 30,
|
|
121
122
|
spacing: 20,
|
|
122
123
|
capThickness: 6,
|
|
123
|
-
capColor:
|
|
124
|
+
capColor: "gray",
|
|
124
125
|
capRadius: 0,
|
|
125
|
-
barBorderColor:
|
|
126
|
+
barBorderColor: "gray",
|
|
126
127
|
|
|
127
128
|
horizontal: false,
|
|
128
129
|
rtl: false,
|
|
@@ -140,15 +141,16 @@ export const BarDefaults = {
|
|
|
140
141
|
showScrollIndicator: false,
|
|
141
142
|
scrollEventThrottle: defaultScrollEventThrottle,
|
|
142
143
|
|
|
143
|
-
side:
|
|
144
|
+
side: "",
|
|
144
145
|
isAnimated: false,
|
|
145
146
|
animationDuration: 800,
|
|
146
147
|
opacity: 1,
|
|
147
148
|
isThreeD: false,
|
|
148
|
-
threeDBarGradientColor:
|
|
149
|
-
threeDBarFrontColor:
|
|
150
|
-
threeDBarSideColor:
|
|
151
|
-
threeDBarTopColor:
|
|
149
|
+
threeDBarGradientColor: "white",
|
|
150
|
+
threeDBarFrontColor: "#C0CA3A",
|
|
151
|
+
threeDBarSideColor: "#887A24",
|
|
152
|
+
threeDBarTopColor: "#D9E676",
|
|
153
|
+
endReachedOffset: defaultEndReachedOffset,
|
|
152
154
|
};
|
|
153
155
|
|
|
154
156
|
export const defaultLineConfig: defaultLineConfigType = {
|
|
@@ -159,14 +161,14 @@ export const defaultLineConfig: defaultLineConfigType = {
|
|
|
159
161
|
isAnimated: false,
|
|
160
162
|
animationDuration: defaultAnimationDuration,
|
|
161
163
|
thickness: 1,
|
|
162
|
-
color:
|
|
164
|
+
color: "black",
|
|
163
165
|
hideDataPoints: false,
|
|
164
|
-
dataPointsShape:
|
|
166
|
+
dataPointsShape: "circular",
|
|
165
167
|
dataPointsWidth: 4,
|
|
166
168
|
dataPointsHeight: 4,
|
|
167
|
-
dataPointsColor:
|
|
169
|
+
dataPointsColor: "black",
|
|
168
170
|
dataPointsRadius: 3,
|
|
169
|
-
textColor:
|
|
171
|
+
textColor: "gray",
|
|
170
172
|
textFontSize: 10,
|
|
171
173
|
textShiftX: 0,
|
|
172
174
|
textShiftY: 0,
|
|
@@ -183,7 +185,7 @@ export const defaultLineConfig: defaultLineConfigType = {
|
|
|
183
185
|
// Line chart specific
|
|
184
186
|
|
|
185
187
|
export const LineDefaults = {
|
|
186
|
-
color:
|
|
188
|
+
color: "black",
|
|
187
189
|
curvature: defaultCurvature,
|
|
188
190
|
curveType: defaultCurveType,
|
|
189
191
|
thickness: 2,
|
|
@@ -204,19 +206,19 @@ export const LineDefaults = {
|
|
|
204
206
|
dataPointsHeight: 4,
|
|
205
207
|
dataPointsWidth: 4,
|
|
206
208
|
dataPointsRadius: 3,
|
|
207
|
-
dataPointsColor:
|
|
208
|
-
dataPointsColor2:
|
|
209
|
-
dataPointsColor3:
|
|
210
|
-
dataPointsShape:
|
|
209
|
+
dataPointsColor: "black",
|
|
210
|
+
dataPointsColor2: "blue",
|
|
211
|
+
dataPointsColor3: "red",
|
|
212
|
+
dataPointsShape: "circular",
|
|
211
213
|
|
|
212
214
|
textFontSize: 10,
|
|
213
|
-
textColor:
|
|
215
|
+
textColor: "gray",
|
|
214
216
|
|
|
215
|
-
startFillColor:
|
|
216
|
-
endFillColor:
|
|
217
|
+
startFillColor: "gray",
|
|
218
|
+
endFillColor: "white",
|
|
217
219
|
lineGradient: false,
|
|
218
|
-
lineGradientStartColor:
|
|
219
|
-
lineGradientEndColor:
|
|
220
|
+
lineGradientStartColor: "lightgreen",
|
|
221
|
+
lineGradientEndColor: "orange",
|
|
220
222
|
startOpacity: 1,
|
|
221
223
|
endOpacity: 1,
|
|
222
224
|
|
|
@@ -228,18 +230,19 @@ export const LineDefaults = {
|
|
|
228
230
|
unFocusOnPressOut: true,
|
|
229
231
|
delayBeforeUnFocus: 300,
|
|
230
232
|
edgePosition: EdgePosition.AT_DATA_POINT,
|
|
233
|
+
endReachedOffset: defaultEndReachedOffset,
|
|
231
234
|
};
|
|
232
235
|
|
|
233
236
|
export const defaultPointerConfig = {
|
|
234
237
|
height: 0,
|
|
235
238
|
width: 0,
|
|
236
239
|
radius: 5,
|
|
237
|
-
pointerColor:
|
|
240
|
+
pointerColor: "red",
|
|
238
241
|
pointerComponent: null,
|
|
239
242
|
showPointerStrip: true,
|
|
240
243
|
pointerStripHeight: AxesAndRulesDefaults.containerHeight, // gets updated to actual containerHeight
|
|
241
244
|
pointerStripWidth: 1,
|
|
242
|
-
pointerStripColor:
|
|
245
|
+
pointerStripColor: "black",
|
|
243
246
|
pointerStripUptoDataPoint: false,
|
|
244
247
|
pointerLabelComponent: null,
|
|
245
248
|
stripOverPointer: false,
|
|
@@ -269,41 +272,41 @@ export const defaultPointerConfig = {
|
|
|
269
272
|
// Pie chart specific
|
|
270
273
|
|
|
271
274
|
export const pieColors = [
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
275
|
+
"cyan",
|
|
276
|
+
"green",
|
|
277
|
+
"orange",
|
|
278
|
+
"purple",
|
|
279
|
+
"#bbff00",
|
|
280
|
+
"red",
|
|
281
|
+
"blue",
|
|
282
|
+
"pink",
|
|
280
283
|
];
|
|
281
284
|
|
|
282
285
|
export const populationDefaults = {
|
|
283
286
|
height: 200,
|
|
284
287
|
width: screenWidth,
|
|
285
|
-
verticalMarginBetweenBars
|
|
288
|
+
verticalMarginBetweenBars: 1,
|
|
286
289
|
barsMapToYAxisSections: true,
|
|
287
290
|
|
|
288
291
|
xAxisNoOfSections: 4,
|
|
289
292
|
showXAxisIndices: true,
|
|
290
293
|
xAxisIndicesWidth: 2,
|
|
291
294
|
xAxisIndicesHeight: 4,
|
|
292
|
-
xAxisIndicesColor:
|
|
295
|
+
xAxisIndicesColor: "black",
|
|
293
296
|
showXAxisLabelTexts: true,
|
|
294
297
|
xAxisRoundToDigits: 0,
|
|
295
298
|
|
|
296
299
|
showVerticalLines: true,
|
|
297
|
-
verticalLinesColor:
|
|
300
|
+
verticalLinesColor: "lightgray",
|
|
298
301
|
verticalLinesThickness: 1,
|
|
299
302
|
verticalLinesType: ruleTypes.DASHED,
|
|
300
|
-
verticalLinesStrokeDashArray: [4,8],
|
|
303
|
+
verticalLinesStrokeDashArray: [4, 8],
|
|
301
304
|
|
|
302
305
|
defaultFontSize: 12,
|
|
303
|
-
defaultFontColor:
|
|
304
|
-
defaultFontStyle: <FontStyle>
|
|
306
|
+
defaultFontColor: "black",
|
|
307
|
+
defaultFontStyle: <FontStyle>"normal",
|
|
305
308
|
defaultFontWeight: 1,
|
|
306
|
-
defaultFontFamily:
|
|
309
|
+
defaultFontFamily: "",
|
|
307
310
|
|
|
308
311
|
yAxisLabelTextMarginRight: 4,
|
|
309
312
|
showValuesAsBarLabels: false,
|
|
@@ -314,10 +317,10 @@ export const populationDefaults = {
|
|
|
314
317
|
leftBarLabelWidth: 30,
|
|
315
318
|
rightBarLabelWidth: 30,
|
|
316
319
|
|
|
317
|
-
leftBarColor:
|
|
318
|
-
rightBarColor:
|
|
319
|
-
leftBarBorderColor:
|
|
320
|
-
rightBarBorderColor:
|
|
320
|
+
leftBarColor: "skyblue",
|
|
321
|
+
rightBarColor: "orange",
|
|
322
|
+
leftBarBorderColor: "blue",
|
|
323
|
+
rightBarBorderColor: "red",
|
|
321
324
|
leftBarBorderWidth: 0,
|
|
322
325
|
rightBarBorderWidth: 0,
|
|
323
326
|
leftBarBorderRadius: 0,
|
|
@@ -326,12 +329,12 @@ export const populationDefaults = {
|
|
|
326
329
|
showSurplus: false,
|
|
327
330
|
showSurplusLeft: false,
|
|
328
331
|
showSurplusRight: false,
|
|
329
|
-
leftSurplusColor:
|
|
330
|
-
leftSurplusBorderColor:
|
|
331
|
-
rightSurplusColor:
|
|
332
|
-
rightSurplusBorderColor:
|
|
332
|
+
leftSurplusColor: "#334790",
|
|
333
|
+
leftSurplusBorderColor: "blue",
|
|
334
|
+
rightSurplusColor: "#AC343C",
|
|
335
|
+
rightSurplusBorderColor: "red",
|
|
333
336
|
leftSurplusBorderWidth: 0,
|
|
334
337
|
rightSurplusBorderWidth: 0,
|
|
335
|
-
prefix:
|
|
336
|
-
suffix:
|
|
337
|
-
}
|
|
338
|
+
prefix: "",
|
|
339
|
+
suffix: "",
|
|
340
|
+
};
|
package/src/utils/types.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {ColorValue} from
|
|
2
|
-
import {chartTypes, yAxisSides} from
|
|
3
|
-
import {lineDataItem} from
|
|
1
|
+
import { ColorValue } from "react-native";
|
|
2
|
+
import { chartTypes, yAxisSides } from "./constants";
|
|
3
|
+
import { lineDataItem } from "../LineChart/types";
|
|
4
4
|
|
|
5
|
-
export type RuleType =
|
|
5
|
+
export type RuleType = "solid" | "dashed" | "dotted" | string;
|
|
6
6
|
|
|
7
7
|
export type RuleTypes = {
|
|
8
8
|
SOLID: RuleType;
|
|
@@ -29,7 +29,7 @@ export type RulesConfig = {
|
|
|
29
29
|
dashGap?: number;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
export type PointerEvents =
|
|
32
|
+
export type PointerEvents = "box-none" | "none" | "box-only" | "auto";
|
|
33
33
|
|
|
34
34
|
export type secondaryYAxisType = {
|
|
35
35
|
noOfSections?: number;
|
|
@@ -211,7 +211,7 @@ export type BarAndLineChartsWrapperTypes = {
|
|
|
211
211
|
scrollToEnd: boolean;
|
|
212
212
|
scrollToIndex: number | undefined;
|
|
213
213
|
scrollAnimation: boolean;
|
|
214
|
-
indicatorColor:
|
|
214
|
+
indicatorColor: "black" | "default" | "white" | undefined;
|
|
215
215
|
setSelectedIndex: any;
|
|
216
216
|
spacing: number;
|
|
217
217
|
showLine: boolean;
|
|
@@ -256,6 +256,7 @@ export type BarAndLineChartsWrapperTypes = {
|
|
|
256
256
|
|
|
257
257
|
onEndReached?: () => void;
|
|
258
258
|
onStartReached?: () => void;
|
|
259
|
+
endReachedOffset: number;
|
|
259
260
|
};
|
|
260
261
|
|
|
261
262
|
export type Pointer = {
|