gifted-charts-core 0.0.25 → 0.0.27
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 +5 -1
- package/src/BarChart/Animated2DWithGradient.d.ts +24 -0
- package/src/BarChart/Animated2DWithGradient.js +108 -0
- package/src/BarChart/RenderStackBars.d.ts +27 -0
- package/src/BarChart/RenderStackBars.js +99 -0
- package/src/BarChart/index.d.ts +175 -0
- package/src/BarChart/index.js +611 -0
- package/src/BarChart/types.d.ts +570 -0
- package/src/BarChart/types.js +1 -0
- package/src/LineChart/LineChartBiColor.d.ts +104 -0
- package/src/LineChart/LineChartBiColor.js +520 -0
- package/src/LineChart/index.d.ts +383 -0
- package/src/LineChart/index.js +1397 -0
- package/src/LineChart/index.ts +4 -3
- package/src/LineChart/types.d.ts +531 -0
- package/src/LineChart/types.js +1 -0
- package/src/PieChart/index.d.ts +33 -0
- package/src/PieChart/index.js +119 -0
- package/src/PieChart/main.d.ts +49 -0
- package/src/PieChart/main.js +185 -0
- package/src/PieChart/types.d.ts +85 -0
- package/src/PieChart/types.js +1 -0
- package/src/PopulationPyramid/index.d.ts +137 -0
- package/src/PopulationPyramid/index.js +233 -0
- package/src/PopulationPyramid/index.ts +3 -3
- package/src/PopulationPyramid/types.d.ts +235 -0
- package/src/PopulationPyramid/types.js +1 -0
- package/src/PopulationPyramid/types.ts +4 -0
- package/src/components/AnimatedThreeDBar/index.d.ts +12 -0
- package/src/components/AnimatedThreeDBar/index.js +53 -0
- package/src/components/BarAndLineChartsWrapper/getHorizSectionsVals.d.ts +20 -0
- package/src/components/BarAndLineChartsWrapper/getHorizSectionsVals.js +217 -0
- package/src/components/BarAndLineChartsWrapper/index.d.ts +97 -0
- package/src/components/BarAndLineChartsWrapper/index.js +266 -0
- package/src/components/BarAndLineChartsWrapper/index.ts +5 -4
- package/src/components/common/StripAndLabel.d.ts +7 -0
- package/src/components/common/StripAndLabel.js +53 -0
- package/src/components/common/StripAndLabel.ts +2 -2
- package/src/components/common/types.d.ts +31 -0
- package/src/components/common/types.js +1 -0
- package/src/components/common/types.ts +1 -0
- package/src/index.d.ts +37 -0
- package/src/index.js +32 -0
- package/src/index.ts +146 -0
- package/src/utils/constants.d.ts +248 -0
- package/src/utils/constants.js +299 -0
- package/src/utils/constants.ts +0 -4
- package/src/utils/index.d.ts +89 -0
- package/src/utils/index.js +1008 -0
- package/src/utils/types.d.ts +337 -0
- package/src/utils/types.js +16 -0
- package/src/utils/types.ts +1 -0
- package/index.ts +0 -141
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gifted-charts-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"src"
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
|
+
"build": "tsc -p .",
|
|
10
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
12
|
"lint": "eslint src/**/*.ts"
|
|
12
13
|
},
|
|
@@ -15,6 +16,9 @@
|
|
|
15
16
|
"@testing-library/react": "^13.4.0",
|
|
16
17
|
"@testing-library/user-event": "^13.5.0",
|
|
17
18
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
19
|
+
"@types/react": "^18.2.14",
|
|
20
|
+
"@types/react-dom": "^18.2.6",
|
|
21
|
+
"@types/react-native": "^0.72.2",
|
|
18
22
|
"eslint": "^8.56.0",
|
|
19
23
|
"eslint-config-standard-with-typescript": "^43.0.1",
|
|
20
24
|
"eslint-plugin-import": "^2.29.1",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ColorValue, type ViewStyle } from 'react-native';
|
|
2
|
+
import { type FocusedBarConfig, type BarChartPropsType, type CommonPropsFor2Dand3DbarsType, type barDataItem, type stackDataItem } from './types';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
interface Animated2dWithGradientPropsType extends BarChartPropsType {
|
|
5
|
+
item: barDataItem;
|
|
6
|
+
index: number;
|
|
7
|
+
barHeight: number;
|
|
8
|
+
selectedIndex: number;
|
|
9
|
+
barBackgroundPattern?: () => ReactNode;
|
|
10
|
+
barInnerComponent?: (item?: stackDataItem | barDataItem, index?: number) => ReactNode;
|
|
11
|
+
patternId?: string;
|
|
12
|
+
barStyle?: object;
|
|
13
|
+
intactTopLabel: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface IgetPropsForAnimated2DWithGradientReturnType {
|
|
16
|
+
commonStyleForBar: ViewStyle[];
|
|
17
|
+
barStyleWithBackground: ViewStyle[];
|
|
18
|
+
commonPropsFor2Dand3Dbars: CommonPropsFor2Dand3DbarsType;
|
|
19
|
+
isFocused?: boolean;
|
|
20
|
+
focusedBarConfig?: FocusedBarConfig;
|
|
21
|
+
localFrontColor: ColorValue;
|
|
22
|
+
}
|
|
23
|
+
export declare const getPropsForAnimated2DWithGradient: (props: Animated2dWithGradientPropsType) => IgetPropsForAnimated2DWithGradientReturnType;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
26
|
+
import { getBarFrontColor, getBarWidth } from '../utils';
|
|
27
|
+
export var getPropsForAnimated2DWithGradient = function (props) {
|
|
28
|
+
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;
|
|
29
|
+
var barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, barBorderRadius = props.barBorderRadius, item = props.item, barBorderTopLeftRadius = props.barBorderTopLeftRadius, barBorderTopRightRadius = props.barBorderTopRightRadius, barBorderBottomLeftRadius = props.barBorderBottomLeftRadius, barBorderBottomRightRadius = props.barBorderBottomRightRadius, barWidth = props.barWidth, barInnerComponent = props.barInnerComponent, barStyle = props.barStyle, index = props.index, opacity = props.opacity, barHeight = props.barHeight, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, roundedBottom = props.roundedBottom, cappedBars = props.cappedBars, capRadius = props.capRadius, roundedTop = props.roundedTop, barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, frontColor = props.frontColor, showGradient = props.showGradient, gradientColor = props.gradientColor, selectedIndex = props.selectedIndex, focusBarOnPress = props.focusBarOnPress, focusedBarConfig = props.focusedBarConfig, isThreeD = props.isThreeD;
|
|
30
|
+
var isFocused = (focusBarOnPress !== null && focusBarOnPress !== void 0 ? focusBarOnPress : false) && selectedIndex === index;
|
|
31
|
+
var itemOrPropsBarBorderRadius = (_b = (_a = item.barBorderRadius) !== null && _a !== void 0 ? _a : barBorderRadius) !== null && _b !== void 0 ? _b : 0;
|
|
32
|
+
var localBarBorderRadius = (isFocused !== null && isFocused !== void 0 ? isFocused : false)
|
|
33
|
+
? (_c = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.borderRadius) !== null && _c !== void 0 ? _c : itemOrPropsBarBorderRadius
|
|
34
|
+
: itemOrPropsBarBorderRadius;
|
|
35
|
+
var localBarWidth = getBarWidth(isFocused, focusedBarConfig, item.barWidth, barWidth);
|
|
36
|
+
var localFrontColor = getBarFrontColor(isFocused, focusedBarConfig, item.frontColor, frontColor, isThreeD);
|
|
37
|
+
var localGradientColor = (_d = item.gradientColor) !== null && _d !== void 0 ? _d : gradientColor;
|
|
38
|
+
var localOpacity = opacity !== null && opacity !== void 0 ? opacity : 1;
|
|
39
|
+
var commonStyleForBar = [
|
|
40
|
+
{
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
width: '100%',
|
|
43
|
+
height: '100%',
|
|
44
|
+
borderWidth: barBorderWidth !== null && barBorderWidth !== void 0 ? barBorderWidth : 0,
|
|
45
|
+
borderColor: barBorderColor,
|
|
46
|
+
borderRadius: localBarBorderRadius,
|
|
47
|
+
borderTopLeftRadius: (_f = (_e = item.barBorderTopLeftRadius) !== null && _e !== void 0 ? _e : barBorderTopLeftRadius) !== null && _f !== void 0 ? _f : localBarBorderRadius,
|
|
48
|
+
borderTopRightRadius: (_h = (_g = item.barBorderTopRightRadius) !== null && _g !== void 0 ? _g : barBorderTopRightRadius) !== null && _h !== void 0 ? _h : localBarBorderRadius,
|
|
49
|
+
borderBottomLeftRadius: (_k = (_j = item.barBorderBottomLeftRadius) !== null && _j !== void 0 ? _j : barBorderBottomLeftRadius) !== null && _k !== void 0 ? _k : localBarBorderRadius,
|
|
50
|
+
borderBottomRightRadius: (_m = (_l = item.barBorderBottomRightRadius) !== null && _l !== void 0 ? _l : barBorderBottomRightRadius) !== null && _m !== void 0 ? _m : localBarBorderRadius
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
if ((_o = roundedBottom !== null && roundedBottom !== void 0 ? roundedBottom : (isFocused && (focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.roundedBottom))) !== null && _o !== void 0 ? _o : false) {
|
|
54
|
+
commonStyleForBar.push({
|
|
55
|
+
borderBottomLeftRadius: localBarWidth / 2,
|
|
56
|
+
borderBottomRightRadius: localBarWidth / 2
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (cappedBars !== null && cappedBars !== void 0 ? cappedBars : false) {
|
|
60
|
+
commonStyleForBar.push({
|
|
61
|
+
borderTopLeftRadius: item.capRadius === 0 ? 0 : (_q = (_p = item.capRadius) !== null && _p !== void 0 ? _p : capRadius) !== null && _q !== void 0 ? _q : 0,
|
|
62
|
+
borderTopRightRadius: item.capRadius === 0 ? 0 : (_s = (_r = item.capRadius) !== null && _r !== void 0 ? _r : capRadius) !== null && _s !== void 0 ? _s : 0
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if ((_t = roundedTop !== null && roundedTop !== void 0 ? roundedTop : (isFocused && (focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.roundedTop))) !== null && _t !== void 0 ? _t : false) {
|
|
66
|
+
commonStyleForBar.push({
|
|
67
|
+
borderTopLeftRadius: localBarWidth / 2,
|
|
68
|
+
borderTopRightRadius: localBarWidth / 2
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
var barStyleWithBackground = __spreadArray(__spreadArray([], __read(commonStyleForBar), false), [
|
|
72
|
+
{
|
|
73
|
+
backgroundColor: localFrontColor
|
|
74
|
+
}
|
|
75
|
+
], false);
|
|
76
|
+
var commonPropsFor2Dand3Dbars = {
|
|
77
|
+
barBackgroundPattern: (_u = item.barBackgroundPattern) !== null && _u !== void 0 ? _u : barBackgroundPattern,
|
|
78
|
+
barInnerComponent: isFocused
|
|
79
|
+
? (_v = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.barInnerComponent) !== null && _v !== void 0 ? _v : barInnerComponent
|
|
80
|
+
: barInnerComponent,
|
|
81
|
+
patternId: (_w = item.patternId) !== null && _w !== void 0 ? _w : patternId,
|
|
82
|
+
barWidth: localBarWidth,
|
|
83
|
+
barStyle: barStyle,
|
|
84
|
+
item: item,
|
|
85
|
+
index: index,
|
|
86
|
+
frontColor: localFrontColor,
|
|
87
|
+
showGradient: (_y = (_x = item.showGradient) !== null && _x !== void 0 ? _x : showGradient) !== null && _y !== void 0 ? _y : false,
|
|
88
|
+
gradientColor: isFocused
|
|
89
|
+
? (_z = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.gradientColor) !== null && _z !== void 0 ? _z : localGradientColor
|
|
90
|
+
: localGradientColor,
|
|
91
|
+
opacity: isFocused
|
|
92
|
+
? (_0 = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.opacity) !== null && _0 !== void 0 ? _0 : localOpacity
|
|
93
|
+
: localOpacity,
|
|
94
|
+
height: barHeight,
|
|
95
|
+
intactTopLabel: intactTopLabel,
|
|
96
|
+
showValuesAsTopLabel: (showValuesAsTopLabel !== null && showValuesAsTopLabel !== void 0 ? showValuesAsTopLabel : false),
|
|
97
|
+
topLabelContainerStyle: topLabelContainerStyle,
|
|
98
|
+
topLabelTextStyle: topLabelTextStyle
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
commonStyleForBar: commonStyleForBar,
|
|
102
|
+
barStyleWithBackground: barStyleWithBackground,
|
|
103
|
+
commonPropsFor2Dand3Dbars: commonPropsFor2Dand3Dbars,
|
|
104
|
+
isFocused: isFocused,
|
|
105
|
+
focusedBarConfig: focusedBarConfig,
|
|
106
|
+
localFrontColor: localFrontColor
|
|
107
|
+
};
|
|
108
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type StackedBarChartPropsType, type stackDataItem } from './types';
|
|
3
|
+
export declare const useRenderStackBars: (props: StackedBarChartPropsType) => {
|
|
4
|
+
cotainsNegative: boolean;
|
|
5
|
+
noAnimation: boolean;
|
|
6
|
+
localBarInnerComponent: ((item?: stackDataItem | undefined, index?: number | undefined) => import("react").ReactNode) | undefined;
|
|
7
|
+
borderRadius: number | undefined;
|
|
8
|
+
borderTopLeftRadius: number | undefined;
|
|
9
|
+
borderTopRightRadius: number | undefined;
|
|
10
|
+
borderBottomLeftRadius: number | undefined;
|
|
11
|
+
borderBottomRightRadius: number | undefined;
|
|
12
|
+
leftSpacing: number;
|
|
13
|
+
disablePress: boolean;
|
|
14
|
+
totalHeight: number;
|
|
15
|
+
height: number;
|
|
16
|
+
setHeight: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
17
|
+
getBarHeight: (value: number, marginBottom?: number) => number;
|
|
18
|
+
getPosition: (index: number) => number;
|
|
19
|
+
getLowestPosition: () => number;
|
|
20
|
+
lowestBarPosition: number;
|
|
21
|
+
getStackBorderRadii: (item: stackDataItem, index: number) => {
|
|
22
|
+
borderTopLeftRadius: number;
|
|
23
|
+
borderTopRightRadius: number;
|
|
24
|
+
borderBottomLeftRadius: number;
|
|
25
|
+
borderBottomRightRadius: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
17
|
+
import { useState } from 'react';
|
|
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;
|
|
21
|
+
var cotainsNegative = item.stacks.some(function (item) { return item.value < 0; });
|
|
22
|
+
var noAnimation = cotainsNegative || !isAnimated;
|
|
23
|
+
var localBarInnerComponent = (_a = item.barInnerComponent) !== null && _a !== void 0 ? _a : props.barInnerComponent;
|
|
24
|
+
var borderRadius = item.borderRadius, borderTopLeftRadius = item.borderTopLeftRadius, borderTopRightRadius = item.borderTopRightRadius, borderBottomLeftRadius = item.borderBottomLeftRadius, borderBottomRightRadius = item.borderBottomRightRadius;
|
|
25
|
+
var leftSpacing = initialSpacing;
|
|
26
|
+
for (var i = 0; i < index; i++) {
|
|
27
|
+
leftSpacing +=
|
|
28
|
+
((_c = (_b = stackData[i].spacing) !== null && _b !== void 0 ? _b : propSpacing) !== null && _c !== void 0 ? _c : 0) +
|
|
29
|
+
((_e = (_d = stackData[i].stacks[0].barWidth) !== null && _d !== void 0 ? _d : props.barWidth) !== null && _e !== void 0 ? _e : 30);
|
|
30
|
+
}
|
|
31
|
+
var disablePress = (_f = props.disablePress) !== null && _f !== void 0 ? _f : false;
|
|
32
|
+
var totalHeight = props.item.stacks.reduce(function (acc, stack) {
|
|
33
|
+
return acc +
|
|
34
|
+
(Math.abs(stack.value) * (containerHeight !== null && containerHeight !== void 0 ? containerHeight : 200)) / (maxValue || 200);
|
|
35
|
+
}, 0);
|
|
36
|
+
var _g = __read(useState(noAnimation ? totalHeight : 1), 2), height = _g[0], setHeight = _g[1];
|
|
37
|
+
var getBarHeight = function (value, marginBottom) {
|
|
38
|
+
return ((Math.abs(value) * (containerHeight !== null && containerHeight !== void 0 ? containerHeight : 200)) / (maxValue || 200) -
|
|
39
|
+
(marginBottom !== null && marginBottom !== void 0 ? marginBottom : 0));
|
|
40
|
+
};
|
|
41
|
+
var getPosition = function (index) {
|
|
42
|
+
/* Returns bottom position for stack item
|
|
43
|
+
negative values are below origin (-> negative position) */
|
|
44
|
+
var height = getBarHeight(item.stacks[index].value, item.stacks[index].marginBottom);
|
|
45
|
+
var itemValue = item.stacks[index].value;
|
|
46
|
+
var isNegative = itemValue <= 0;
|
|
47
|
+
var position = isNegative ? -(height || 0) : 0;
|
|
48
|
+
for (var i = 0; i < index; i++) {
|
|
49
|
+
var valueOnIndex = item.stacks[i].value;
|
|
50
|
+
if (isNegative && valueOnIndex <= 0) {
|
|
51
|
+
position +=
|
|
52
|
+
(valueOnIndex * (containerHeight !== null && containerHeight !== void 0 ? containerHeight : 200)) / (maxValue || 200);
|
|
53
|
+
}
|
|
54
|
+
else if (!isNegative && valueOnIndex >= 0) {
|
|
55
|
+
position +=
|
|
56
|
+
(valueOnIndex * (containerHeight !== null && containerHeight !== void 0 ? containerHeight : 200)) / (maxValue || 200);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return position;
|
|
60
|
+
};
|
|
61
|
+
var getLowestPosition = function () {
|
|
62
|
+
var _a;
|
|
63
|
+
return (((_a = item.stacks
|
|
64
|
+
.map(function (_, index) { return getPosition(index); })
|
|
65
|
+
.sort(function (a, b) { return a - b; })) === null || _a === void 0 ? void 0 : _a[0]) || 0);
|
|
66
|
+
};
|
|
67
|
+
var lowestBarPosition = getLowestPosition();
|
|
68
|
+
var getStackBorderRadii = function (item, index) {
|
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
70
|
+
var stackItem = item.stacks[index];
|
|
71
|
+
var borderRadii = {
|
|
72
|
+
borderTopLeftRadius: (_d = (_c = (_b = (_a = stackItem.borderTopLeftRadius) !== null && _a !== void 0 ? _a : stackItem.borderRadius) !== null && _b !== void 0 ? _b : props.barBorderTopLeftRadius) !== null && _c !== void 0 ? _c : props.barBorderRadius) !== null && _d !== void 0 ? _d : 0,
|
|
73
|
+
borderTopRightRadius: (_h = (_g = (_f = (_e = stackItem.borderTopRightRadius) !== null && _e !== void 0 ? _e : stackItem.borderRadius) !== null && _f !== void 0 ? _f : props.barBorderTopRightRadius) !== null && _g !== void 0 ? _g : props.barBorderRadius) !== null && _h !== void 0 ? _h : 0,
|
|
74
|
+
borderBottomLeftRadius: (_m = (_l = (_k = (_j = stackItem.borderBottomLeftRadius) !== null && _j !== void 0 ? _j : stackItem.borderRadius) !== null && _k !== void 0 ? _k : props.barBorderBottomLeftRadius) !== null && _l !== void 0 ? _l : props.barBorderRadius) !== null && _m !== void 0 ? _m : 0,
|
|
75
|
+
borderBottomRightRadius: (_r = (_q = (_p = (_o = stackItem.borderBottomRightRadius) !== null && _o !== void 0 ? _o : stackItem.borderRadius) !== null && _p !== void 0 ? _p : props.barBorderBottomRightRadius) !== null && _q !== void 0 ? _q : props.barBorderRadius) !== null && _r !== void 0 ? _r : 0
|
|
76
|
+
};
|
|
77
|
+
return borderRadii;
|
|
78
|
+
};
|
|
79
|
+
return {
|
|
80
|
+
cotainsNegative: cotainsNegative,
|
|
81
|
+
noAnimation: noAnimation,
|
|
82
|
+
localBarInnerComponent: localBarInnerComponent,
|
|
83
|
+
borderRadius: borderRadius,
|
|
84
|
+
borderTopLeftRadius: borderTopLeftRadius,
|
|
85
|
+
borderTopRightRadius: borderTopRightRadius,
|
|
86
|
+
borderBottomLeftRadius: borderBottomLeftRadius,
|
|
87
|
+
borderBottomRightRadius: borderBottomRightRadius,
|
|
88
|
+
leftSpacing: leftSpacing,
|
|
89
|
+
disablePress: disablePress,
|
|
90
|
+
totalHeight: totalHeight,
|
|
91
|
+
height: height,
|
|
92
|
+
setHeight: setHeight,
|
|
93
|
+
getBarHeight: getBarHeight,
|
|
94
|
+
getPosition: getPosition,
|
|
95
|
+
getLowestPosition: getLowestPosition,
|
|
96
|
+
lowestBarPosition: lowestBarPosition,
|
|
97
|
+
getStackBorderRadii: getStackBorderRadii
|
|
98
|
+
};
|
|
99
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type lineConfigType, type BarChartPropsType, type barDataItem, type stackDataItem } from './types';
|
|
3
|
+
import { type BarAndLineChartsWrapperTypes, type secondaryYAxisType } from '../utils/types';
|
|
4
|
+
import { type Animated } from 'react-native';
|
|
5
|
+
export interface extendedBarChartPropsType extends BarChartPropsType {
|
|
6
|
+
heightValue: Animated.Value;
|
|
7
|
+
widthValue: Animated.Value;
|
|
8
|
+
opacValue: Animated.Value;
|
|
9
|
+
verticalLinesUptoDataPoint?: boolean;
|
|
10
|
+
secondaryYAxis?: secondaryYAxisType | boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
13
|
+
lineConfig: lineConfigType;
|
|
14
|
+
hidePointer1: boolean;
|
|
15
|
+
pointerItem: barDataItem | stackDataItem | undefined;
|
|
16
|
+
pointerY: number;
|
|
17
|
+
pointerConfig: import("../utils/types").Pointer | undefined;
|
|
18
|
+
pointerColor: import("react-native").ColorValue;
|
|
19
|
+
pointerX: number;
|
|
20
|
+
pointerComponent: Function | null;
|
|
21
|
+
pointerHeight: number;
|
|
22
|
+
pointerRadius: number;
|
|
23
|
+
pointerWidth: number;
|
|
24
|
+
autoAdjustPointerLabelPosition: boolean;
|
|
25
|
+
pointerLabelWidth: number;
|
|
26
|
+
activatePointersOnLongPress: boolean;
|
|
27
|
+
yAxisLabelWidth: number;
|
|
28
|
+
shiftPointerLabelX: number;
|
|
29
|
+
pointerLabelHeight: number;
|
|
30
|
+
pointerStripUptoDataPoint: boolean;
|
|
31
|
+
pointerStripHeight: number;
|
|
32
|
+
shiftPointerLabelY: number;
|
|
33
|
+
showPointerStrip: boolean;
|
|
34
|
+
pointerStripWidth: number;
|
|
35
|
+
containerHeight: number;
|
|
36
|
+
xAxisThickness: number;
|
|
37
|
+
pointerStripColor: import("react-native").ColorValue;
|
|
38
|
+
pointerEvents: import("../utils/types").PointerEvents | undefined;
|
|
39
|
+
setResponderStartTime: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
40
|
+
setPointerY: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
41
|
+
setPointerItem: import("react").Dispatch<import("react").SetStateAction<barDataItem | stackDataItem | undefined>>;
|
|
42
|
+
initialSpacing: number;
|
|
43
|
+
spacing: number;
|
|
44
|
+
data: barDataItem[];
|
|
45
|
+
barWidth: number;
|
|
46
|
+
setPointerX: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
47
|
+
setPointerIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
48
|
+
maxValue: number;
|
|
49
|
+
responderStartTime: number;
|
|
50
|
+
responderActive: boolean;
|
|
51
|
+
setResponderActive: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
52
|
+
activatePointersDelay: number;
|
|
53
|
+
persistPointer: boolean;
|
|
54
|
+
pointerVanishDelay: number;
|
|
55
|
+
containerHeightIncludingBelowXAxis: number;
|
|
56
|
+
extendedContainerHeight: number;
|
|
57
|
+
totalWidth: number;
|
|
58
|
+
stripBehindBars: boolean;
|
|
59
|
+
noOfSectionsBelowXAxis: number;
|
|
60
|
+
stepHeight: number;
|
|
61
|
+
xAxisLabelsVerticalShift: number;
|
|
62
|
+
labelsExtraHeight: number;
|
|
63
|
+
stripOverPointer: boolean;
|
|
64
|
+
pointerLabelComponent: Function | null;
|
|
65
|
+
opacity: number;
|
|
66
|
+
rotateLabel: boolean;
|
|
67
|
+
showXAxisIndices: boolean;
|
|
68
|
+
xAxisIndicesHeight: number;
|
|
69
|
+
xAxisIndicesWidth: number;
|
|
70
|
+
xAxisIndicesColor: import("react-native").ColorValue;
|
|
71
|
+
horizontal: boolean;
|
|
72
|
+
rtl: boolean;
|
|
73
|
+
intactTopLabel: boolean;
|
|
74
|
+
barBorderColor: import("react-native").ColorValue;
|
|
75
|
+
barInnerComponent: ((item?: barDataItem | stackDataItem | undefined, index?: number | undefined) => import("react").ReactNode) | undefined;
|
|
76
|
+
xAxisTextNumberOfLines: number;
|
|
77
|
+
selectedIndex: number;
|
|
78
|
+
setSelectedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
79
|
+
isAnimated: boolean;
|
|
80
|
+
animationDuration: number;
|
|
81
|
+
side: string;
|
|
82
|
+
labelWidth: number;
|
|
83
|
+
isThreeD: boolean;
|
|
84
|
+
animatedHeight: Animated.AnimatedInterpolation<string | number>;
|
|
85
|
+
appearingOpacity: Animated.AnimatedInterpolation<string | number>;
|
|
86
|
+
autoShiftLabels: boolean;
|
|
87
|
+
yAxisAtTop: boolean;
|
|
88
|
+
secondaryData: import("..").lineDataItem[] | barDataItem[] | undefined;
|
|
89
|
+
disableScroll: boolean;
|
|
90
|
+
showScrollIndicator: boolean;
|
|
91
|
+
scrollToEnd: boolean;
|
|
92
|
+
scrollAnimation: boolean;
|
|
93
|
+
scrollEventThrottle: number;
|
|
94
|
+
showLine: boolean;
|
|
95
|
+
lineConfig2: lineConfigType;
|
|
96
|
+
lineData: (import("..").lineDataItem | barDataItem | stackDataItem)[];
|
|
97
|
+
lineData2: (import("..").lineDataItem | barDataItem | stackDataItem)[] | undefined;
|
|
98
|
+
animatedWidth: Animated.AnimatedInterpolation<string | number>;
|
|
99
|
+
lineBehindBars: boolean;
|
|
100
|
+
points: string;
|
|
101
|
+
setPoints: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
102
|
+
points2: string;
|
|
103
|
+
setPoints2: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
104
|
+
arrowPoints: string;
|
|
105
|
+
setArrowPoints: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
106
|
+
horizSections: {
|
|
107
|
+
value: string;
|
|
108
|
+
}[];
|
|
109
|
+
endSpacing: number;
|
|
110
|
+
horizontalRulesStyle: any;
|
|
111
|
+
noOfSections: number;
|
|
112
|
+
showFractionalValues: boolean;
|
|
113
|
+
widthFromProps: number | undefined;
|
|
114
|
+
stepValue: number;
|
|
115
|
+
secondaryMaxValue: number;
|
|
116
|
+
getPointerProps: Function | null;
|
|
117
|
+
pointerIndex: number;
|
|
118
|
+
getPropsCommonForBarAndStack: (item: any, index: number) => {
|
|
119
|
+
key: number;
|
|
120
|
+
item: any;
|
|
121
|
+
index: number;
|
|
122
|
+
containerHeight: number;
|
|
123
|
+
maxValue: number;
|
|
124
|
+
spacing: any;
|
|
125
|
+
propSpacing: number;
|
|
126
|
+
xAxisThickness: number;
|
|
127
|
+
barWidth: number | undefined;
|
|
128
|
+
opacity: number;
|
|
129
|
+
disablePress: any;
|
|
130
|
+
rotateLabel: boolean;
|
|
131
|
+
showXAxisIndices: boolean;
|
|
132
|
+
xAxisIndicesHeight: number;
|
|
133
|
+
xAxisIndicesWidth: number;
|
|
134
|
+
xAxisIndicesColor: import("react-native").ColorValue;
|
|
135
|
+
horizontal: boolean;
|
|
136
|
+
rtl: boolean;
|
|
137
|
+
intactTopLabel: boolean;
|
|
138
|
+
showValuesAsTopLabel: boolean | undefined;
|
|
139
|
+
topLabelContainerStyle: any;
|
|
140
|
+
topLabelTextStyle: any;
|
|
141
|
+
barBorderWidth: number | undefined;
|
|
142
|
+
barBorderColor: import("react-native").ColorValue;
|
|
143
|
+
barBorderRadius: number | undefined;
|
|
144
|
+
barBorderTopLeftRadius: number | undefined;
|
|
145
|
+
barBorderTopRightRadius: number | undefined;
|
|
146
|
+
barBorderBottomLeftRadius: number | undefined;
|
|
147
|
+
barBorderBottomRightRadius: number | undefined;
|
|
148
|
+
barInnerComponent: ((item?: barDataItem | stackDataItem | undefined, index?: number | undefined) => import("react").ReactNode) | undefined;
|
|
149
|
+
color: import("react-native").ColorValue | undefined;
|
|
150
|
+
showGradient: boolean | undefined;
|
|
151
|
+
gradientColor: import("react-native").ColorValue | undefined;
|
|
152
|
+
barBackgroundPattern: (() => import("react").ReactNode) | undefined;
|
|
153
|
+
patternId: string | undefined;
|
|
154
|
+
onPress: Function | undefined;
|
|
155
|
+
onLongPress: Function | undefined;
|
|
156
|
+
onPressOut: Function | undefined;
|
|
157
|
+
focusBarOnPress: boolean | undefined;
|
|
158
|
+
focusedBarConfig: import("./types").FocusedBarConfig | undefined;
|
|
159
|
+
xAxisTextNumberOfLines: number;
|
|
160
|
+
xAxisLabelsHeight: number | undefined;
|
|
161
|
+
xAxisLabelsVerticalShift: number;
|
|
162
|
+
renderTooltip: Function | undefined;
|
|
163
|
+
leftShiftForTooltip: number;
|
|
164
|
+
initialSpacing: number;
|
|
165
|
+
selectedIndex: number;
|
|
166
|
+
setSelectedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
167
|
+
activeOpacity: number;
|
|
168
|
+
noOfSectionsBelowXAxis: number;
|
|
169
|
+
leftShiftForLastIndexTooltip: number;
|
|
170
|
+
label: any;
|
|
171
|
+
labelTextStyle: any;
|
|
172
|
+
pointerConfig: import("../utils/types").Pointer | undefined;
|
|
173
|
+
};
|
|
174
|
+
barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes;
|
|
175
|
+
};
|