gifted-charts-core 0.1.13 → 0.1.15
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/README.md +1 -1
- package/package.json +1 -1
- package/src/BarChart/RenderStackBars.d.ts +13 -0
- package/src/BarChart/RenderStackBars.js +18 -4
- package/src/BarChart/RenderStackBars.ts +22 -2
- package/src/BarChart/index.d.ts +1 -1
- package/src/BarChart/index.js +2 -2
- package/src/BarChart/index.ts +3 -2
- package/src/BarChart/types.d.ts +6 -0
- package/src/BarChart/types.ts +6 -0
- package/src/LineChart/index.js +1 -0
- package/src/LineChart/index.ts +1 -0
- package/src/LineChart/types.d.ts +6 -1
- package/src/LineChart/types.ts +7 -1
- package/src/utils/index.js +1 -1
- package/src/utils/index.ts +1 -1
- package/src/utils/types.d.ts +1 -0
- package/src/utils/types.ts +1 -0
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
This library contains the common code used by [react-native-gifted-charts](https://
|
|
1
|
+
This library contains the common code used by [react-native-gifted-charts](https://www.npmjs.com/package/react-native-gifted-charts) and [react-gifted-charts](https://www.npmjs.com/package/react-gifted-charts).
|
package/package.json
CHANGED
|
@@ -24,4 +24,17 @@ export declare const useRenderStackBars: (props: StackedBarChartPropsType) => {
|
|
|
24
24
|
borderBottomLeftRadius: number;
|
|
25
25
|
borderBottomRightRadius: number;
|
|
26
26
|
};
|
|
27
|
+
tooltipProps: {
|
|
28
|
+
barHeight: number;
|
|
29
|
+
barWidth: number;
|
|
30
|
+
item: stackDataItem;
|
|
31
|
+
index: number;
|
|
32
|
+
isLast: boolean;
|
|
33
|
+
leftSpacing: number;
|
|
34
|
+
leftShiftForLastIndexTooltip: number;
|
|
35
|
+
leftShiftForTooltip: number;
|
|
36
|
+
renderTooltip: Function | undefined;
|
|
37
|
+
autoCenterTooltip: boolean | undefined;
|
|
38
|
+
horizontal: boolean;
|
|
39
|
+
};
|
|
27
40
|
};
|
|
@@ -16,8 +16,8 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
16
16
|
};
|
|
17
17
|
import { useState } from 'react';
|
|
18
18
|
export var useRenderStackBars = function (props) {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f;
|
|
20
|
-
var item = props.item, index = props.index, containerHeight = props.containerHeight, maxValue = props.maxValue, propSpacing = props.propSpacing, initialSpacing = props.initialSpacing, stackData = props.stackData, isAnimated = props.isAnimated, xAxisThickness = props.xAxisThickness;
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
20
|
+
var item = props.item, index = props.index, containerHeight = props.containerHeight, maxValue = props.maxValue, propSpacing = props.propSpacing, initialSpacing = props.initialSpacing, stackData = props.stackData, isAnimated = props.isAnimated, xAxisThickness = props.xAxisThickness, renderTooltip = props.renderTooltip, leftShiftForTooltip = props.leftShiftForTooltip, leftShiftForLastIndexTooltip = props.leftShiftForLastIndexTooltip, autoCenterTooltip = props.autoCenterTooltip, horizontal = props.horizontal;
|
|
21
21
|
var cotainsNegative = item.stacks.some(function (item) { return item.value < 0; });
|
|
22
22
|
var noAnimation = cotainsNegative || !isAnimated;
|
|
23
23
|
var localBarInnerComponent = (_a = item.barInnerComponent) !== null && _a !== void 0 ? _a : props.barInnerComponent;
|
|
@@ -33,7 +33,7 @@ export var useRenderStackBars = function (props) {
|
|
|
33
33
|
return acc +
|
|
34
34
|
(Math.abs(stack.value) * (containerHeight !== null && containerHeight !== void 0 ? containerHeight : 200)) / (maxValue || 200);
|
|
35
35
|
}, 0);
|
|
36
|
-
var
|
|
36
|
+
var _j = __read(useState(noAnimation ? totalHeight : 1), 2), height = _j[0], setHeight = _j[1];
|
|
37
37
|
var getBarHeight = function (value, marginBottom) {
|
|
38
38
|
return ((Math.abs(value) * (containerHeight !== null && containerHeight !== void 0 ? containerHeight : 200)) / (maxValue || 200) -
|
|
39
39
|
(marginBottom !== null && marginBottom !== void 0 ? marginBottom : 0));
|
|
@@ -76,6 +76,19 @@ export var useRenderStackBars = function (props) {
|
|
|
76
76
|
};
|
|
77
77
|
return borderRadii;
|
|
78
78
|
};
|
|
79
|
+
var tooltipProps = {
|
|
80
|
+
barHeight: totalHeight,
|
|
81
|
+
barWidth: item.barWidth || props.barWidth || 30,
|
|
82
|
+
item: item,
|
|
83
|
+
index: index,
|
|
84
|
+
isLast: index === stackData.length - 1,
|
|
85
|
+
leftSpacing: leftSpacing,
|
|
86
|
+
leftShiftForLastIndexTooltip: leftShiftForLastIndexTooltip,
|
|
87
|
+
leftShiftForTooltip: (_h = (_g = item.leftShiftForTooltip) !== null && _g !== void 0 ? _g : leftShiftForTooltip) !== null && _h !== void 0 ? _h : 0,
|
|
88
|
+
renderTooltip: renderTooltip,
|
|
89
|
+
autoCenterTooltip: autoCenterTooltip,
|
|
90
|
+
horizontal: horizontal
|
|
91
|
+
};
|
|
79
92
|
return {
|
|
80
93
|
cotainsNegative: cotainsNegative,
|
|
81
94
|
noAnimation: noAnimation,
|
|
@@ -94,6 +107,7 @@ export var useRenderStackBars = function (props) {
|
|
|
94
107
|
getPosition: getPosition,
|
|
95
108
|
getLowestPosition: getLowestPosition,
|
|
96
109
|
lowestBarPosition: lowestBarPosition,
|
|
97
|
-
getStackBorderRadii: getStackBorderRadii
|
|
110
|
+
getStackBorderRadii: getStackBorderRadii,
|
|
111
|
+
tooltipProps: tooltipProps
|
|
98
112
|
};
|
|
99
113
|
};
|
|
@@ -11,7 +11,12 @@ export const useRenderStackBars = (props: StackedBarChartPropsType) => {
|
|
|
11
11
|
initialSpacing,
|
|
12
12
|
stackData,
|
|
13
13
|
isAnimated,
|
|
14
|
-
xAxisThickness
|
|
14
|
+
xAxisThickness,
|
|
15
|
+
renderTooltip,
|
|
16
|
+
leftShiftForTooltip,
|
|
17
|
+
leftShiftForLastIndexTooltip,
|
|
18
|
+
autoCenterTooltip,
|
|
19
|
+
horizontal
|
|
15
20
|
} = props
|
|
16
21
|
const cotainsNegative = item.stacks.some((item) => item.value < 0)
|
|
17
22
|
const noAnimation = cotainsNegative || !isAnimated
|
|
@@ -117,6 +122,20 @@ export const useRenderStackBars = (props: StackedBarChartPropsType) => {
|
|
|
117
122
|
return borderRadii
|
|
118
123
|
}
|
|
119
124
|
|
|
125
|
+
const tooltipProps = {
|
|
126
|
+
barHeight: totalHeight,
|
|
127
|
+
barWidth: item.barWidth || props.barWidth || 30,
|
|
128
|
+
item,
|
|
129
|
+
index,
|
|
130
|
+
isLast: index === stackData.length - 1,
|
|
131
|
+
leftSpacing,
|
|
132
|
+
leftShiftForLastIndexTooltip,
|
|
133
|
+
leftShiftForTooltip: item.leftShiftForTooltip ?? leftShiftForTooltip ?? 0,
|
|
134
|
+
renderTooltip,
|
|
135
|
+
autoCenterTooltip,
|
|
136
|
+
horizontal
|
|
137
|
+
}
|
|
138
|
+
|
|
120
139
|
return {
|
|
121
140
|
cotainsNegative,
|
|
122
141
|
noAnimation,
|
|
@@ -135,6 +154,7 @@ export const useRenderStackBars = (props: StackedBarChartPropsType) => {
|
|
|
135
154
|
getPosition,
|
|
136
155
|
getLowestPosition,
|
|
137
156
|
lowestBarPosition,
|
|
138
|
-
getStackBorderRadii
|
|
157
|
+
getStackBorderRadii,
|
|
158
|
+
tooltipProps
|
|
139
159
|
}
|
|
140
160
|
}
|
package/src/BarChart/index.d.ts
CHANGED
|
@@ -119,7 +119,6 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
119
119
|
getPointerProps: Function | null;
|
|
120
120
|
pointerIndex: number;
|
|
121
121
|
getPropsCommonForBarAndStack: (item: any, index: number) => {
|
|
122
|
-
key: number;
|
|
123
122
|
item: any;
|
|
124
123
|
index: number;
|
|
125
124
|
containerHeight: number;
|
|
@@ -165,6 +164,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
165
164
|
xAxisLabelsVerticalShift: number;
|
|
166
165
|
renderTooltip: Function | undefined;
|
|
167
166
|
leftShiftForTooltip: number;
|
|
167
|
+
autoCenterTooltip: boolean | undefined;
|
|
168
168
|
initialSpacing: number;
|
|
169
169
|
selectedIndex: number;
|
|
170
170
|
setSelectedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
package/src/BarChart/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import { getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPad
|
|
|
30
30
|
import { AxesAndRulesDefaults, BarDefaults, chartTypes, defaultLineConfig, defaultPointerConfig } from '../utils/constants';
|
|
31
31
|
export var useBarChart = function (props) {
|
|
32
32
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _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;
|
|
33
|
-
var heightValue = props.heightValue, widthValue = props.widthValue, opacValue = props.opacValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, parentWidth = props.parentWidth, labelsDistanceFromXaxis = props.labelsDistanceFromXaxis, autoShiftLabelsForNegativeStacks = props.autoShiftLabelsForNegativeStacks, focusedBarIndex = props.focusedBarIndex, negativeStepValue = props.negativeStepValue;
|
|
33
|
+
var heightValue = props.heightValue, widthValue = props.widthValue, opacValue = props.opacValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, parentWidth = props.parentWidth, labelsDistanceFromXaxis = props.labelsDistanceFromXaxis, autoShiftLabelsForNegativeStacks = props.autoShiftLabelsForNegativeStacks, focusedBarIndex = props.focusedBarIndex, negativeStepValue = props.negativeStepValue, autoCenterTooltip = props.autoCenterTooltip;
|
|
34
34
|
var _48 = __read(useState(''), 2), points = _48[0], setPoints = _48[1];
|
|
35
35
|
var _49 = __read(useState(''), 2), points2 = _49[0], setPoints2 = _49[1];
|
|
36
36
|
var _50 = __read(useState(''), 2), arrowPoints = _50[0], setArrowPoints = _50[1];
|
|
@@ -396,7 +396,6 @@ export var useBarChart = function (props) {
|
|
|
396
396
|
var getPropsCommonForBarAndStack = function (item, index) {
|
|
397
397
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
398
398
|
return {
|
|
399
|
-
key: index,
|
|
400
399
|
item: item,
|
|
401
400
|
index: index,
|
|
402
401
|
containerHeight: containerHeight,
|
|
@@ -442,6 +441,7 @@ export var useBarChart = function (props) {
|
|
|
442
441
|
xAxisLabelsVerticalShift: xAxisLabelsVerticalShift,
|
|
443
442
|
renderTooltip: props.renderTooltip,
|
|
444
443
|
leftShiftForTooltip: (_e = props.leftShiftForTooltip) !== null && _e !== void 0 ? _e : 0,
|
|
444
|
+
autoCenterTooltip: autoCenterTooltip,
|
|
445
445
|
initialSpacing: initialSpacing,
|
|
446
446
|
selectedIndex: selectedIndex,
|
|
447
447
|
setSelectedIndex: setSelectedIndex,
|
package/src/BarChart/index.ts
CHANGED
|
@@ -52,7 +52,8 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
52
52
|
labelsDistanceFromXaxis,
|
|
53
53
|
autoShiftLabelsForNegativeStacks,
|
|
54
54
|
focusedBarIndex,
|
|
55
|
-
negativeStepValue
|
|
55
|
+
negativeStepValue,
|
|
56
|
+
autoCenterTooltip
|
|
56
57
|
} = props
|
|
57
58
|
const [points, setPoints] = useState('')
|
|
58
59
|
const [points2, setPoints2] = useState('')
|
|
@@ -637,7 +638,6 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
637
638
|
|
|
638
639
|
const getPropsCommonForBarAndStack = (item: any, index: number) => {
|
|
639
640
|
return {
|
|
640
|
-
key: index,
|
|
641
641
|
item,
|
|
642
642
|
index,
|
|
643
643
|
containerHeight,
|
|
@@ -684,6 +684,7 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
684
684
|
xAxisLabelsVerticalShift,
|
|
685
685
|
renderTooltip: props.renderTooltip,
|
|
686
686
|
leftShiftForTooltip: props.leftShiftForTooltip ?? 0,
|
|
687
|
+
autoCenterTooltip,
|
|
687
688
|
initialSpacing,
|
|
688
689
|
selectedIndex,
|
|
689
690
|
setSelectedIndex,
|
package/src/BarChart/types.d.ts
CHANGED
|
@@ -103,6 +103,7 @@ export interface StackedBarChartPropsType {
|
|
|
103
103
|
renderTooltip: Function | undefined;
|
|
104
104
|
leftShiftForTooltip?: number;
|
|
105
105
|
leftShiftForLastIndexTooltip: number;
|
|
106
|
+
autoCenterTooltip?: boolean;
|
|
106
107
|
initialSpacing: number;
|
|
107
108
|
selectedIndex: number;
|
|
108
109
|
setSelectedIndex: Function;
|
|
@@ -215,6 +216,7 @@ export interface BarChartPropsType {
|
|
|
215
216
|
disableScroll?: boolean;
|
|
216
217
|
showScrollIndicator?: boolean;
|
|
217
218
|
indicatorColor?: 'black' | 'default' | 'white';
|
|
219
|
+
nestedScrollEnabled?: boolean;
|
|
218
220
|
roundedTop?: boolean;
|
|
219
221
|
roundedBottom?: boolean;
|
|
220
222
|
disablePress?: boolean;
|
|
@@ -271,6 +273,7 @@ export interface BarChartPropsType {
|
|
|
271
273
|
onPressOut?: Function;
|
|
272
274
|
renderTooltip?: Function;
|
|
273
275
|
leftShiftForTooltip?: number;
|
|
276
|
+
autoCenterTooltip?: boolean;
|
|
274
277
|
leftShiftForLastIndexTooltip?: number;
|
|
275
278
|
barStyle?: object;
|
|
276
279
|
barInnerComponent?: (item?: stackDataItem | barDataItem, index?: number) => ReactNode;
|
|
@@ -406,9 +409,11 @@ export interface barDataItem {
|
|
|
406
409
|
patternId?: string;
|
|
407
410
|
barMarginBottom?: number;
|
|
408
411
|
leftShiftForTooltip?: number;
|
|
412
|
+
autoCenterTooltip?: boolean;
|
|
409
413
|
barStyle?: object;
|
|
410
414
|
barInnerComponent?: (item?: barDataItem, index?: number) => ReactNode;
|
|
411
415
|
showXAxisIndex?: boolean;
|
|
416
|
+
isSecondary?: boolean;
|
|
412
417
|
}
|
|
413
418
|
export interface Animated2DWithGradientPropsType {
|
|
414
419
|
item: barDataItem;
|
|
@@ -522,6 +527,7 @@ export interface RenderBarsPropsType {
|
|
|
522
527
|
xAxisLabelsVerticalShift: number;
|
|
523
528
|
renderTooltip: Function | undefined;
|
|
524
529
|
leftShiftForTooltip?: number;
|
|
530
|
+
autoCenterTooltip?: boolean;
|
|
525
531
|
leftShiftForLastIndexTooltip: number;
|
|
526
532
|
initialSpacing: number;
|
|
527
533
|
selectedIndex: number;
|
package/src/BarChart/types.ts
CHANGED
|
@@ -121,6 +121,7 @@ export interface StackedBarChartPropsType {
|
|
|
121
121
|
renderTooltip: Function | undefined
|
|
122
122
|
leftShiftForTooltip?: number
|
|
123
123
|
leftShiftForLastIndexTooltip: number
|
|
124
|
+
autoCenterTooltip?: boolean
|
|
124
125
|
initialSpacing: number
|
|
125
126
|
selectedIndex: number
|
|
126
127
|
setSelectedIndex: Function
|
|
@@ -240,6 +241,7 @@ export interface BarChartPropsType {
|
|
|
240
241
|
disableScroll?: boolean
|
|
241
242
|
showScrollIndicator?: boolean
|
|
242
243
|
indicatorColor?: 'black' | 'default' | 'white'
|
|
244
|
+
nestedScrollEnabled?: boolean
|
|
243
245
|
roundedTop?: boolean
|
|
244
246
|
roundedBottom?: boolean
|
|
245
247
|
disablePress?: boolean
|
|
@@ -300,6 +302,7 @@ export interface BarChartPropsType {
|
|
|
300
302
|
onPressOut?: Function
|
|
301
303
|
renderTooltip?: Function
|
|
302
304
|
leftShiftForTooltip?: number
|
|
305
|
+
autoCenterTooltip?: boolean
|
|
303
306
|
leftShiftForLastIndexTooltip?: number
|
|
304
307
|
barStyle?: object
|
|
305
308
|
barInnerComponent?: (
|
|
@@ -446,9 +449,11 @@ export interface barDataItem {
|
|
|
446
449
|
patternId?: string
|
|
447
450
|
barMarginBottom?: number
|
|
448
451
|
leftShiftForTooltip?: number
|
|
452
|
+
autoCenterTooltip?: boolean
|
|
449
453
|
barStyle?: object
|
|
450
454
|
barInnerComponent?: (item?: barDataItem, index?: number) => ReactNode
|
|
451
455
|
showXAxisIndex?: boolean
|
|
456
|
+
isSecondary?: boolean
|
|
452
457
|
}
|
|
453
458
|
|
|
454
459
|
export interface Animated2DWithGradientPropsType {
|
|
@@ -569,6 +574,7 @@ export interface RenderBarsPropsType {
|
|
|
569
574
|
xAxisLabelsVerticalShift: number
|
|
570
575
|
renderTooltip: Function | undefined
|
|
571
576
|
leftShiftForTooltip?: number
|
|
577
|
+
autoCenterTooltip?: boolean
|
|
572
578
|
leftShiftForLastIndexTooltip: number
|
|
573
579
|
initialSpacing: number
|
|
574
580
|
selectedIndex: number
|
package/src/LineChart/index.js
CHANGED
|
@@ -1096,6 +1096,7 @@ export var useLineChart = function (props) {
|
|
|
1096
1096
|
endSpacing: endSpacing,
|
|
1097
1097
|
horizontalRulesStyle: horizontalRulesStyle,
|
|
1098
1098
|
noOfSections: noOfSections,
|
|
1099
|
+
sectionColors: props.sectionColors,
|
|
1099
1100
|
showFractionalValues: showFractionalValues,
|
|
1100
1101
|
axesAndRulesProps: getAxesAndRulesProps(props, stepValue, undefined),
|
|
1101
1102
|
yAxisLabelTexts: props.yAxisLabelTexts,
|
package/src/LineChart/index.ts
CHANGED
|
@@ -1822,6 +1822,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
1822
1822
|
endSpacing,
|
|
1823
1823
|
horizontalRulesStyle,
|
|
1824
1824
|
noOfSections,
|
|
1825
|
+
sectionColors: props.sectionColors,
|
|
1825
1826
|
showFractionalValues,
|
|
1826
1827
|
|
|
1827
1828
|
axesAndRulesProps: getAxesAndRulesProps(props, stepValue, undefined),
|
package/src/LineChart/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ColorValue } from 'react-native';
|
|
1
|
+
import { GestureResponderEvent, type ColorValue } from 'react-native';
|
|
2
2
|
import { type yAxisSides } from '../utils/constants';
|
|
3
3
|
import { type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType } from '../utils/types';
|
|
4
4
|
export interface LineChartPropsType {
|
|
@@ -6,6 +6,7 @@ export interface LineChartPropsType {
|
|
|
6
6
|
overflowTop?: number;
|
|
7
7
|
overflowBottom?: number;
|
|
8
8
|
noOfSections?: number;
|
|
9
|
+
sectionColors?: ColorValue[];
|
|
9
10
|
maxValue?: number;
|
|
10
11
|
mostNegativeValue?: number;
|
|
11
12
|
stepHeight?: number;
|
|
@@ -107,6 +108,7 @@ export interface LineChartPropsType {
|
|
|
107
108
|
pointerConfig?: Pointer;
|
|
108
109
|
showScrollIndicator?: boolean;
|
|
109
110
|
indicatorColor?: 'black' | 'default' | 'white';
|
|
111
|
+
nestedScrollEnabled?: boolean;
|
|
110
112
|
showYAxisIndices?: boolean;
|
|
111
113
|
showXAxisIndices?: boolean;
|
|
112
114
|
yAxisIndicesHeight?: number;
|
|
@@ -295,6 +297,8 @@ export interface LineChartPropsType {
|
|
|
295
297
|
interpolateMissingValues?: boolean;
|
|
296
298
|
onlyPositive?: boolean;
|
|
297
299
|
parentWidth?: number;
|
|
300
|
+
onChartAreaPress?: (event: GestureResponderEvent) => void;
|
|
301
|
+
onBackgroundPress?: (event: GestureResponderEvent) => void;
|
|
298
302
|
}
|
|
299
303
|
export interface lineDataItem {
|
|
300
304
|
value: number;
|
|
@@ -451,6 +455,7 @@ export interface LineChartBicolorPropsType {
|
|
|
451
455
|
disableScroll?: boolean;
|
|
452
456
|
showScrollIndicator?: boolean;
|
|
453
457
|
indicatorColor?: 'black' | 'default' | 'white';
|
|
458
|
+
nestedScrollEnabled?: boolean;
|
|
454
459
|
showYAxisIndices?: boolean;
|
|
455
460
|
showXAxisIndices?: boolean;
|
|
456
461
|
yAxisIndicesHeight?: number;
|
package/src/LineChart/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ColorValue } from 'react-native'
|
|
1
|
+
import { GestureResponderEvent, type ColorValue } from 'react-native'
|
|
2
2
|
import { type yAxisSides } from '../utils/constants'
|
|
3
3
|
import {
|
|
4
4
|
type CurveType,
|
|
@@ -20,6 +20,7 @@ export interface LineChartPropsType {
|
|
|
20
20
|
overflowTop?: number
|
|
21
21
|
overflowBottom?: number
|
|
22
22
|
noOfSections?: number
|
|
23
|
+
sectionColors?: ColorValue[]
|
|
23
24
|
maxValue?: number
|
|
24
25
|
mostNegativeValue?: number
|
|
25
26
|
stepHeight?: number
|
|
@@ -125,6 +126,7 @@ export interface LineChartPropsType {
|
|
|
125
126
|
pointerConfig?: Pointer
|
|
126
127
|
showScrollIndicator?: boolean
|
|
127
128
|
indicatorColor?: 'black' | 'default' | 'white'
|
|
129
|
+
nestedScrollEnabled?: boolean
|
|
128
130
|
|
|
129
131
|
// Indices
|
|
130
132
|
|
|
@@ -329,6 +331,9 @@ export interface LineChartPropsType {
|
|
|
329
331
|
interpolateMissingValues?: boolean
|
|
330
332
|
onlyPositive?: boolean
|
|
331
333
|
parentWidth?: number
|
|
334
|
+
|
|
335
|
+
onChartAreaPress?: (event: GestureResponderEvent) => void
|
|
336
|
+
onBackgroundPress?: (event: GestureResponderEvent) => void
|
|
332
337
|
}
|
|
333
338
|
|
|
334
339
|
export interface lineDataItem {
|
|
@@ -502,6 +507,7 @@ export interface LineChartBicolorPropsType {
|
|
|
502
507
|
disableScroll?: boolean
|
|
503
508
|
showScrollIndicator?: boolean
|
|
504
509
|
indicatorColor?: 'black' | 'default' | 'white'
|
|
510
|
+
nestedScrollEnabled?: boolean
|
|
505
511
|
|
|
506
512
|
// Indices
|
|
507
513
|
|
package/src/utils/index.js
CHANGED
|
@@ -545,7 +545,7 @@ export var getAxesAndRulesProps = function (props, stepValue, negativeStepValue,
|
|
|
545
545
|
};
|
|
546
546
|
if (((_c = props.secondaryYAxis) !== null && _c !== void 0 ? _c : (_d = props.lineConfig) === null || _d === void 0 ? void 0 : _d.isSecondary) &&
|
|
547
547
|
maxValue !== undefined &&
|
|
548
|
-
secondaryYAxis.maxValue === undefined) {
|
|
548
|
+
secondaryYAxis && secondaryYAxis.maxValue === undefined) {
|
|
549
549
|
axesAndRulesProps.secondaryYAxis = __assign(__assign({}, secondaryYAxis), { maxValue: maxValue });
|
|
550
550
|
}
|
|
551
551
|
return axesAndRulesProps;
|
package/src/utils/index.ts
CHANGED
|
@@ -744,7 +744,7 @@ export const getAxesAndRulesProps = (
|
|
|
744
744
|
if (
|
|
745
745
|
(props.secondaryYAxis ?? props.lineConfig?.isSecondary) &&
|
|
746
746
|
maxValue !== undefined &&
|
|
747
|
-
secondaryYAxis.maxValue === undefined
|
|
747
|
+
secondaryYAxis && secondaryYAxis.maxValue === undefined
|
|
748
748
|
) {
|
|
749
749
|
axesAndRulesProps.secondaryYAxis = { ...secondaryYAxis, maxValue }
|
|
750
750
|
}
|
package/src/utils/types.d.ts
CHANGED