react-native-gifted-charts 1.4.73 → 1.4.74
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
CHANGED
|
@@ -104,10 +104,10 @@ const data=[ {value:50}, {value:80}, {value:90}, {value:70} ]
|
|
|
104
104
|
<PieChart data = {data} />
|
|
105
105
|
<PopulationPyramid data = {[{left:10,right:12}, {left:9,right:8}]} />
|
|
106
106
|
<RadarChart data = {[50, 80, 90, 70]} />
|
|
107
|
-
<BubbleChart data = {
|
|
107
|
+
<BubbleChart data = {[
|
|
108
108
|
{x: 20, y: 4, r: 10},
|
|
109
109
|
{x: 40, y: 6, r: 20},
|
|
110
|
-
} />
|
|
110
|
+
]} />
|
|
111
111
|
|
|
112
112
|
// For Horizontal Bar chart, just add the prop horizontal to the <BarChart/> component
|
|
113
113
|
|
|
@@ -9,22 +9,38 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
12
28
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { BubbleDefaults, useBubbleChart, } from 'gifted-charts-core';
|
|
29
|
+
import { BubbleDefaults, useBubbleChart, withinMinMaxRange, } from 'gifted-charts-core';
|
|
14
30
|
import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
|
|
15
|
-
import { Fragment, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
31
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
16
32
|
import { Animated, Easing, I18nManager, Text, View, } from 'react-native';
|
|
17
|
-
import { Circle, ForeignObject, Rect, Svg, Line } from 'react-native-svg';
|
|
18
|
-
import { isWebApp, screenWidth } from '../utils';
|
|
33
|
+
import { Circle, ForeignObject, Rect, Svg, Line, RadialGradient, Stop, Defs, } from 'react-native-svg';
|
|
34
|
+
import { isAndroid, isWebApp, screenWidth } from '../utils';
|
|
19
35
|
var AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
20
36
|
var AnimatedRect = Animated.createAnimatedComponent(Rect);
|
|
21
37
|
var AnimatedLine = Animated.createAnimatedComponent(Line);
|
|
22
38
|
export var BubbleChart = function (props) {
|
|
23
|
-
var _a, _b, _c, _d
|
|
39
|
+
var _a, _b, _c, _d;
|
|
24
40
|
var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
25
41
|
var pointsOpacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
26
42
|
var secondaryXAxis = props.secondaryXAxis, xAxisLabelTextStyle = props.xAxisLabelTextStyle, formatBubbleLabel = props.formatBubbleLabel;
|
|
27
|
-
var
|
|
43
|
+
var _e = useBubbleChart(__assign(__assign({}, props), { parentWidth: (_a = props.parentWidth) !== null && _a !== void 0 ? _a : screenWidth })), data = _e.data, barAndLineChartsWrapperProps = _e.barAndLineChartsWrapperProps, totalWidth = _e.totalWidth, animationDuration = _e.animationDuration, _f = _e.containerHeightIncludingBelowXAxis, containerHeightIncludingBelowXAxis = _f === void 0 ? 0 : _f, getY = _e.getY, getX = _e.getX, maxValue = _e.maxValue, selectedIndex = _e.selectedIndex, setSelectedIndex = _e.setSelectedIndex, showTextOnFocus = _e.showTextOnFocus, focusEnabled = _e.focusEnabled, focusTogether = _e.focusTogether, selectedLineNumber = _e.selectedLineNumber, lastLineNumber = _e.lastLineNumber, initialSpacing = _e.initialSpacing, spacing = _e.spacing, containerHeight = _e.containerHeight, handleFocus = _e.handleFocus, handleUnFocus = _e.handleUnFocus, isAnimated = _e.isAnimated, showBubbleOnFocus = _e.showBubbleOnFocus, showBubbleLabelOnFocus = _e.showBubbleLabelOnFocus, bubblesShape = _e.bubblesShape, bubblesWidth = _e.bubblesWidth, bubblesHeight = _e.bubblesHeight, bubblesColor = _e.bubblesColor, bubblesRadius = _e.bubblesRadius, labelFontSize = _e.labelFontSize, labelTextStyle = _e.labelTextStyle, startIndex = _e.startIndex, endIndex = _e.endIndex, showValuesAsBubbleLabels = _e.showValuesAsBubbleLabels, hideBubbles = _e.hideBubbles, xAxisLabelsVerticalShift = _e.xAxisLabelsVerticalShift, labelsExtraHeight = _e.labelsExtraHeight, xAxisThickness = _e.xAxisThickness, xAxisTextNumberOfLines = _e.xAxisTextNumberOfLines, rotateLabel = _e.rotateLabel, allowFontScaling = _e.allowFontScaling, borderColor = _e.borderColor, borderWidth = _e.borderWidth, opacity = _e.opacity, borderOpacity = _e.borderOpacity, xAxisLabelTexts = _e.xAxisLabelTexts, showRegressionLine = _e.showRegressionLine, regressionLineX1 = _e.regressionLineX1, regressionLineY1 = _e.regressionLineY1, regressionLineX2 = _e.regressionLineX2, regressionLineY2 = _e.regressionLineY2, regressionLineConfig = _e.regressionLineConfig, scatterChart = _e.scatterChart, maxRadius = _e.maxRadius, minRadius = _e.minRadius, extraWidthDueToBubble = _e.extraWidthDueToBubble, showGradient = _e.showGradient, centerColorForGradient = _e.centerColorForGradient;
|
|
28
44
|
var progress = useRef(new Animated.Value(0)).current;
|
|
29
45
|
var AnimatedRegressionLineX = useRef(new Animated.Value(0)).current;
|
|
30
46
|
var AnimatedRegressionLineY = useRef(new Animated.Value(0)).current;
|
|
@@ -39,33 +55,43 @@ export var BubbleChart = function (props) {
|
|
|
39
55
|
// outputRange:[regressionLineX1,regressionLineX2]
|
|
40
56
|
// })
|
|
41
57
|
var growingRadii = useMemo(function () {
|
|
42
|
-
|
|
43
|
-
return ((_a = props.data) !== null && _a !== void 0 ? _a : []).map(function (item) {
|
|
58
|
+
return (data !== null && data !== void 0 ? data : []).map(function (item) {
|
|
44
59
|
var _a;
|
|
45
60
|
return progress.interpolate({
|
|
46
61
|
inputRange: [0, 1],
|
|
47
|
-
outputRange: [
|
|
62
|
+
outputRange: [
|
|
63
|
+
0,
|
|
64
|
+
withinMinMaxRange((_a = item.r) !== null && _a !== void 0 ? _a : bubblesRadius, maxRadius, minRadius),
|
|
65
|
+
],
|
|
48
66
|
});
|
|
49
67
|
});
|
|
50
|
-
}, [
|
|
51
|
-
var growingHeight = (
|
|
52
|
-
var _a
|
|
68
|
+
}, [data, progress]);
|
|
69
|
+
var growingHeight = (data !== null && data !== void 0 ? data : []).map(function (_, i) {
|
|
70
|
+
var _a;
|
|
53
71
|
return progress.interpolate({
|
|
54
72
|
inputRange: [0, 1],
|
|
55
|
-
outputRange: [0, (
|
|
73
|
+
outputRange: [0, (_a = data === null || data === void 0 ? void 0 : data[i].bubbleHeight) !== null && _a !== void 0 ? _a : bubblesHeight],
|
|
56
74
|
});
|
|
57
75
|
});
|
|
58
|
-
var growingWidth = (
|
|
59
|
-
var _a
|
|
76
|
+
var growingWidth = (data !== null && data !== void 0 ? data : []).map(function (_, i) {
|
|
77
|
+
var _a;
|
|
60
78
|
return progress.interpolate({
|
|
61
79
|
inputRange: [0, 1],
|
|
62
|
-
outputRange: [0, (
|
|
80
|
+
outputRange: [0, (_a = data === null || data === void 0 ? void 0 : data[i].bubbleWidth) !== null && _a !== void 0 ? _a : bubblesWidth],
|
|
63
81
|
});
|
|
64
82
|
});
|
|
65
83
|
var appearingDataPoints = pointsOpacityValue.interpolate({
|
|
66
84
|
inputRange: [0, 1],
|
|
67
85
|
outputRange: [0, opacity],
|
|
68
86
|
});
|
|
87
|
+
var appearingDataPointsAndroid = pointsOpacityValue.interpolate({
|
|
88
|
+
inputRange: [0, 1],
|
|
89
|
+
outputRange: [0, opacity / 2], // hack to show slightly transparent bubbles while animating, as gradient on Android can't be animated
|
|
90
|
+
});
|
|
91
|
+
var appearingBorder = pointsOpacityValue.interpolate({
|
|
92
|
+
inputRange: [0, 1],
|
|
93
|
+
outputRange: [0, borderOpacity],
|
|
94
|
+
});
|
|
69
95
|
var drawRegressionLine = useCallback(function () {
|
|
70
96
|
if (!regressionLineConfig.isAnimated)
|
|
71
97
|
return;
|
|
@@ -135,6 +161,7 @@ export var BubbleChart = function (props) {
|
|
|
135
161
|
useNativeDriver: false,
|
|
136
162
|
}).start();
|
|
137
163
|
}, [pointsOpacityValue]);
|
|
164
|
+
var _g = __read(useState(false), 2), isAnimationOver = _g[0], setIsAnimationOver = _g[1];
|
|
138
165
|
useEffect(function () {
|
|
139
166
|
if (isAnimated) {
|
|
140
167
|
decreaseWidth();
|
|
@@ -146,12 +173,17 @@ export var BubbleChart = function (props) {
|
|
|
146
173
|
else {
|
|
147
174
|
radiiGrow();
|
|
148
175
|
}
|
|
176
|
+
if (isAndroid) {
|
|
177
|
+
setTimeout(function () {
|
|
178
|
+
setIsAnimationOver(true);
|
|
179
|
+
}, animationDuration + 20);
|
|
180
|
+
}
|
|
149
181
|
}
|
|
150
182
|
if (regressionLineConfig.isAnimated) {
|
|
151
183
|
drawRegressionLine();
|
|
152
184
|
}
|
|
153
185
|
}, [isAnimated, bubblesShape]);
|
|
154
|
-
var svgHeight = containerHeightIncludingBelowXAxis + ((
|
|
186
|
+
var svgHeight = containerHeightIncludingBelowXAxis + ((_c = props.overflowBottom) !== null && _c !== void 0 ? _c : 0);
|
|
155
187
|
// const onStripPress = (item: any, index: number) => {
|
|
156
188
|
// if (props.focusedBubbleIndex === undefined || !props.onFocus) {
|
|
157
189
|
// setSelectedIndex(index);
|
|
@@ -162,6 +194,9 @@ export var BubbleChart = function (props) {
|
|
|
162
194
|
// };
|
|
163
195
|
var renderLabel = function (top, index, label) {
|
|
164
196
|
var _a, _b;
|
|
197
|
+
var left = index
|
|
198
|
+
? initialSpacing + spacing * index - spacing / 2
|
|
199
|
+
: initialSpacing / 2;
|
|
165
200
|
return (_jsx(View, { style: [
|
|
166
201
|
{
|
|
167
202
|
position: 'absolute',
|
|
@@ -172,14 +207,17 @@ export var BubbleChart = function (props) {
|
|
|
172
207
|
: -xAxisTextNumberOfLines * 18 - (containerHeight - 200) / 20,
|
|
173
208
|
zIndex: 10,
|
|
174
209
|
width: spacing + labelsExtraHeight,
|
|
175
|
-
left:
|
|
210
|
+
left: left,
|
|
176
211
|
height: (_b = props.xAxisLabelsHeight) !== null && _b !== void 0 ? _b : xAxisTextNumberOfLines * 18,
|
|
177
212
|
},
|
|
178
213
|
rotateLabel && { transform: [{ rotate: '60deg' }] },
|
|
179
|
-
], children: _jsx(Text, { style: [{ textAlign: 'center' }, xAxisLabelTextStyle], allowFontScaling: allowFontScaling, numberOfLines: xAxisTextNumberOfLines, children: label }) }));
|
|
214
|
+
], children: _jsx(Text, { style: [{ textAlign: index ? 'center' : 'left' }, xAxisLabelTextStyle], allowFontScaling: allowFontScaling, numberOfLines: xAxisTextNumberOfLines, children: label }) }));
|
|
180
215
|
};
|
|
181
216
|
var renderAnimatedLabel = function (top, index, label) {
|
|
182
217
|
var _a, _b;
|
|
218
|
+
var left = index
|
|
219
|
+
? initialSpacing + spacing * index - spacing / 2
|
|
220
|
+
: initialSpacing / 2;
|
|
183
221
|
return (_jsx(Animated.View, { style: [
|
|
184
222
|
{
|
|
185
223
|
height: rotateLabel
|
|
@@ -194,17 +232,17 @@ export var BubbleChart = function (props) {
|
|
|
194
232
|
? 10
|
|
195
233
|
: -xAxisTextNumberOfLines * 18,
|
|
196
234
|
zIndex: 10,
|
|
197
|
-
width: spacing,
|
|
198
|
-
left:
|
|
235
|
+
width: spacing + labelsExtraHeight,
|
|
236
|
+
left: left,
|
|
199
237
|
opacity: appearingOpacity,
|
|
200
238
|
},
|
|
201
239
|
rotateLabel && { transform: [{ rotate: '60deg' }] },
|
|
202
|
-
], children: _jsx(Text, { allowFontScaling: allowFontScaling, style: [{ textAlign: 'center' }, xAxisLabelTextStyle], numberOfLines: xAxisTextNumberOfLines, children: label }) }));
|
|
240
|
+
], children: _jsx(Text, { allowFontScaling: allowFontScaling, style: [{ textAlign: index ? 'center' : 'left' }, xAxisLabelTextStyle], numberOfLines: xAxisTextNumberOfLines, children: label }) }));
|
|
203
241
|
};
|
|
204
242
|
var renderBubbles = function (hideBubbles, dataForRender, originalDataFromProps, bubsShape, bubsWidth, bubsHeight, bubsColor, bubsRadius, labelFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText, key) {
|
|
205
243
|
var getYOrSecondaryY = getY; //isSecondary ? getSecondaryY : getY;
|
|
206
244
|
return dataForRender.map(function (item, index) {
|
|
207
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
245
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
208
246
|
if (index < startIndex || index > endIndex)
|
|
209
247
|
return null;
|
|
210
248
|
if (item.hideBubble) {
|
|
@@ -232,8 +270,7 @@ export var BubbleChart = function (props) {
|
|
|
232
270
|
item.focusedBubbleColor ||
|
|
233
271
|
props.focusedBubbleColor ||
|
|
234
272
|
BubbleDefaults.focusedBubbleColor;
|
|
235
|
-
bubblesRadius =
|
|
236
|
-
(_c = (_b = (_a = item.focusedBubbleRadius) !== null && _a !== void 0 ? _a : props.focusedBubbleRadius) !== null && _b !== void 0 ? _b : item.r) !== null && _c !== void 0 ? _c : bubsRadius;
|
|
273
|
+
bubblesRadius = withinMinMaxRange((_c = (_b = (_a = item.focusedBubbleRadius) !== null && _a !== void 0 ? _a : props.focusedBubbleRadius) !== null && _b !== void 0 ? _b : item.r) !== null && _c !== void 0 ? _c : bubsRadius, maxRadius, minRadius);
|
|
237
274
|
if (showTextOnFocus) {
|
|
238
275
|
text = item.label;
|
|
239
276
|
}
|
|
@@ -253,7 +290,7 @@ export var BubbleChart = function (props) {
|
|
|
253
290
|
bubblesWidth = item.bubbleWidth || bubsWidth;
|
|
254
291
|
bubblesHeight = item.bubbleHeight || bubsHeight;
|
|
255
292
|
dataPointsColor = item.bubbleColor || bubsColor;
|
|
256
|
-
bubblesRadius = (_d = item.r) !== null && _d !== void 0 ? _d : bubsRadius;
|
|
293
|
+
bubblesRadius = withinMinMaxRange((_d = item.r) !== null && _d !== void 0 ? _d : bubsRadius, maxRadius, minRadius);
|
|
257
294
|
if (showTextOnFocus) {
|
|
258
295
|
text = '';
|
|
259
296
|
}
|
|
@@ -277,6 +314,9 @@ export var BubbleChart = function (props) {
|
|
|
277
314
|
var textStyle = ((_g = (_f = item.labelTextStyle) !== null && _f !== void 0 ? _f : labelTextStyle) !== null && _g !== void 0 ? _g : {});
|
|
278
315
|
var fontSize = textStyle.fontSize || item.labelFontSize || labelFontSize;
|
|
279
316
|
var defaultFontSize = 14;
|
|
317
|
+
var fillColorForAnimatedGradientOnAndroid = isAnimationOver
|
|
318
|
+
? "url(#radial".concat(index, ")")
|
|
319
|
+
: dataPointsColor;
|
|
280
320
|
return (_jsxs(Fragment, { children: [focusEnabled ? (_jsx(_Fragment, { children: key === lastLineNumber - 1 ? (_jsx(Rect, { x: initialSpacing + (spacing * index - spacing / 2), y: 8, width: spacing, height: containerHeight - 0, fill: 'none', onPressIn: function (evt) {
|
|
281
321
|
var locationY = evt.nativeEvent.locationY; // Note that we have another property named pageY which can be useful
|
|
282
322
|
handleFocus(index);
|
|
@@ -291,7 +331,7 @@ export var BubbleChart = function (props) {
|
|
|
291
331
|
? index === selectedIndex
|
|
292
332
|
? dataPointsColor
|
|
293
333
|
: 'none'
|
|
294
|
-
: dataPointsColor, stroke: (_h = item.borderColor) !== null && _h !== void 0 ? _h : borderColor, strokeWidth: (_j = item.borderWidth) !== null && _j !== void 0 ? _j : borderWidth, strokeOpacity: (_l = (_k = item.borderOpacity) !== null && _k !== void 0 ? _k : props.borderOpacity) !== null && _l !== void 0 ? _l : (isAnimated ?
|
|
334
|
+
: dataPointsColor, fillOpacity: isAnimated ? appearingDataPoints : opacity, stroke: (_h = item.borderColor) !== null && _h !== void 0 ? _h : borderColor, strokeWidth: (_j = item.borderWidth) !== null && _j !== void 0 ? _j : borderWidth, strokeOpacity: (_l = (_k = item.borderOpacity) !== null && _k !== void 0 ? _k : props.borderOpacity) !== null && _l !== void 0 ? _l : (isAnimated ? appearingBorder : borderOpacity), onPress: function () {
|
|
295
335
|
item.onPress
|
|
296
336
|
? item.onPress(item, index)
|
|
297
337
|
: props.onPress
|
|
@@ -303,11 +343,17 @@ export var BubbleChart = function (props) {
|
|
|
303
343
|
if (!item.onPress && !props.onPress && focusEnabled) {
|
|
304
344
|
handleUnFocus();
|
|
305
345
|
}
|
|
306
|
-
} })) }, index)) : (_jsx(Fragment, { children: customBubble ? null : (_jsx(AnimatedCircle, { cx: getX(index), cy: getYOrSecondaryY(item.y), r: isAnimated ? growingRadii[index] : bubblesRadius, fill:
|
|
307
|
-
?
|
|
308
|
-
?
|
|
309
|
-
:
|
|
310
|
-
: dataPointsColor,
|
|
346
|
+
} })) }, index)) : (_jsx(Fragment, { children: customBubble ? null : (_jsx(AnimatedCircle, { cx: getX(index), cy: getYOrSecondaryY(item.y), r: isAnimated ? growingRadii[index] : bubblesRadius, fill: ((_m = item.showGradient) !== null && _m !== void 0 ? _m : showGradient)
|
|
347
|
+
? isAndroid && isAnimated
|
|
348
|
+
? fillColorForAnimatedGradientOnAndroid
|
|
349
|
+
: "url(#radial".concat(index, ")")
|
|
350
|
+
: dataPointsColor, fillOpacity: isAnimated
|
|
351
|
+
? isAndroid && showGradient
|
|
352
|
+
? isAnimationOver
|
|
353
|
+
? opacity
|
|
354
|
+
: appearingDataPointsAndroid
|
|
355
|
+
: appearingDataPoints
|
|
356
|
+
: opacity, stroke: (_o = item.borderColor) !== null && _o !== void 0 ? _o : borderColor, strokeWidth: (_p = item.borderWidth) !== null && _p !== void 0 ? _p : borderWidth, strokeOpacity: (_r = (_q = item.borderOpacity) !== null && _q !== void 0 ? _q : props.borderOpacity) !== null && _r !== void 0 ? _r : (isAnimated ? appearingBorder : borderOpacity), onPress: function () {
|
|
311
357
|
item.onPress
|
|
312
358
|
? item.onPress(item, index)
|
|
313
359
|
: props.onPress
|
|
@@ -359,7 +405,7 @@ export var BubbleChart = function (props) {
|
|
|
359
405
|
(item.labelShiftY || props.labelShiftY || 0) -
|
|
360
406
|
(scatterChart ? bubblesRadius + 10 : 0), fontSize: fontSize, opacity: isAnimated
|
|
361
407
|
? appearingDataPoints
|
|
362
|
-
: ((
|
|
408
|
+
: ((_s = textStyle.opacity) !== null && _s !== void 0 ? _s : 1) }), children: formattedTextLabel }))) : null) : null, index === selectedIndex ? _jsx(Text, { children: '' }) : null] }))] }, index));
|
|
363
409
|
});
|
|
364
410
|
};
|
|
365
411
|
var svgWrapperViewStyle = {
|
|
@@ -373,11 +419,14 @@ export var BubbleChart = function (props) {
|
|
|
373
419
|
return (_jsxs(View, { style: [
|
|
374
420
|
svgWrapperViewStyle,
|
|
375
421
|
{
|
|
376
|
-
width: totalWidth,
|
|
422
|
+
width: totalWidth + extraWidthDueToBubble,
|
|
377
423
|
height: containerHeightIncludingBelowXAxis,
|
|
378
424
|
// zIndex,
|
|
379
425
|
},
|
|
380
|
-
], children: [_jsxs(Svg, { height: svgHeight, width: totalWidth, onPress: props.onBackgroundPress, children: [
|
|
426
|
+
], children: [_jsxs(Svg, { height: svgHeight, width: totalWidth + extraWidthDueToBubble, onPress: props.onBackgroundPress, children: [showGradient && (_jsx(Defs, { children: data === null || data === void 0 ? void 0 : data.map(function (item, index) {
|
|
427
|
+
var _a;
|
|
428
|
+
return (_jsxs(RadialGradient, { id: "radial".concat(index), cx: "50%", cy: "50%", r: "50%", children: [_jsx(Stop, { offset: "0%", stopColor: (_a = item.centerColorForGradient) !== null && _a !== void 0 ? _a : centerColorForGradient }), _jsx(Stop, { offset: "100%", stopColor: item.bubbleColor || bubblesColor })] }, index));
|
|
429
|
+
}) })), renderBubbles(hideBubbles, data, data, bubblesShape, bubblesWidth, bubblesHeight, bubblesColor, bubblesRadius, labelFontSize, startIndex, endIndex, false, showValuesAsBubbleLabels, 0), showRegressionLine && (_jsx(AnimatedLine, { x1: regressionLineX1, y1: regressionLineY1, x2: regressionLineConfig.isAnimated
|
|
381
430
|
? AnimatedRegressionLineX
|
|
382
431
|
: regressionLineX2, y2: regressionLineConfig.isAnimated
|
|
383
432
|
? AnimatedRegressionLineY
|
|
@@ -393,7 +442,7 @@ export var BubbleChart = function (props) {
|
|
|
393
442
|
(_a = props.onScroll) === null || _a === void 0 ? void 0 : _a.call(props, ev);
|
|
394
443
|
},
|
|
395
444
|
bounces: props.bounces,
|
|
396
|
-
overScrollMode: (
|
|
445
|
+
overScrollMode: (_d = props.overScrollMode) !== null && _d !== void 0 ? _d : 'auto',
|
|
397
446
|
};
|
|
398
447
|
return (_jsx(BarAndLineChartsWrapper, __assign({}, barAndLineChartsWrapperProps, { scrollRef: scrollRef, animatedWidth: widthValue, renderChartContent: renderChartContent, remainingScrollViewProps: remainingScrollViewProps, nestedScrollEnabled: props.nestedScrollEnabled })));
|
|
399
448
|
};
|
|
@@ -26,9 +26,9 @@ var isCloseToLeft = function (_a, endReachedOffset) {
|
|
|
26
26
|
contentSize.width - endReachedOffset);
|
|
27
27
|
};
|
|
28
28
|
var BarAndLineChartsWrapper = function (props) {
|
|
29
|
-
var _a, _b, _c, _d, _e;
|
|
30
|
-
var chartType = props.chartType, containerHeight = props.containerHeight, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, stepHeight = props.stepHeight, labelsExtraHeight = props.labelsExtraHeight, yAxisLabelWidth = props.yAxisLabelWidth, horizontal = props.horizontal, scrollRef = props.scrollRef, initialSpacing = props.initialSpacing, data = props.data, barWidth = props.barWidth, xAxisThickness = props.xAxisThickness, totalWidth = props.totalWidth, disableScroll = props.disableScroll, showScrollIndicator = props.showScrollIndicator, scrollToEnd = props.scrollToEnd, scrollToIndex = props.scrollToIndex, scrollAnimation = props.scrollAnimation, indicatorColor = props.indicatorColor, spacing = props.spacing, renderChartContent = props.renderChartContent, remainingScrollViewProps = props.remainingScrollViewProps, endSpacing = props.endSpacing, hideAxesAndRules = props.hideAxesAndRules, showXAxisIndices = props.showXAxisIndices, xAxisIndicesHeight = props.xAxisIndicesHeight, xAxisIndicesWidth = props.xAxisIndicesWidth, xAxisIndicesColor = props.xAxisIndicesColor, pointerConfig = props.pointerConfig, getPointerProps = props.getPointerProps, pointerIndex = props.pointerIndex, pointerX = props.pointerX, pointerY = props.pointerY, onEndReached = props.onEndReached, onStartReached = props.onStartReached, endReachedOffset = props.endReachedOffset, onMomentumScrollEnd = props.onMomentumScrollEnd, onScrollEndDrag = props.onScrollEndDrag, nestedScrollEnabled = props.nestedScrollEnabled,
|
|
31
|
-
var
|
|
29
|
+
var _a, _b, _c, _d, _e, _f;
|
|
30
|
+
var chartType = props.chartType, containerHeight = props.containerHeight, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, stepHeight = props.stepHeight, labelsExtraHeight = props.labelsExtraHeight, yAxisLabelWidth = props.yAxisLabelWidth, horizontal = props.horizontal, scrollRef = props.scrollRef, initialSpacing = props.initialSpacing, data = props.data, barWidth = props.barWidth, xAxisThickness = props.xAxisThickness, totalWidth = props.totalWidth, disableScroll = props.disableScroll, showScrollIndicator = props.showScrollIndicator, scrollToEnd = props.scrollToEnd, scrollToIndex = props.scrollToIndex, scrollAnimation = props.scrollAnimation, indicatorColor = props.indicatorColor, spacing = props.spacing, renderChartContent = props.renderChartContent, remainingScrollViewProps = props.remainingScrollViewProps, endSpacing = props.endSpacing, hideAxesAndRules = props.hideAxesAndRules, showXAxisIndices = props.showXAxisIndices, xAxisIndicesHeight = props.xAxisIndicesHeight, xAxisIndicesWidth = props.xAxisIndicesWidth, xAxisIndicesColor = props.xAxisIndicesColor, pointerConfig = props.pointerConfig, getPointerProps = props.getPointerProps, pointerIndex = props.pointerIndex, pointerX = props.pointerX, pointerY = props.pointerY, onEndReached = props.onEndReached, onStartReached = props.onStartReached, endReachedOffset = props.endReachedOffset, onMomentumScrollEnd = props.onMomentumScrollEnd, onScrollEndDrag = props.onScrollEndDrag, nestedScrollEnabled = props.nestedScrollEnabled, _g = props.extraWidthDueToDataPoint, extraWidthDueToDataPoint = _g === void 0 ? 0 : _g;
|
|
31
|
+
var _h = useBarAndLineChartsWrapper(__assign(__assign({}, props), { isRTL: I18nManager.isRTL })), containerHeightIncludingBelowXAxis = _h.containerHeightIncludingBelowXAxis, xAxisLabelsVerticalShift = _h.xAxisLabelsVerticalShift, trimYAxisAtTop = _h.trimYAxisAtTop, yAxisExtraHeight = _h.yAxisExtraHeight, overflowTop = _h.overflowTop, xAxisLabelsHeight = _h.xAxisLabelsHeight, xAxisTextNumberOfLines = _h.xAxisTextNumberOfLines, actualContainerWidth = _h.actualContainerWidth, transformForHorizontal = _h.transformForHorizontal, horizSectionProps = _h.horizSectionProps, referenceLinesOverChartContent = _h.referenceLinesOverChartContent, setCanMomentum = _h.setCanMomentum, isCloseToStart = _h.isCloseToStart, isCloseToEnd = _h.isCloseToEnd, canMomentum = _h.canMomentum, yAxisAtTop = _h.yAxisAtTop, yAxisThickness = _h.yAxisThickness, yAxisSide = _h.yAxisSide, showVerticalLines = _h.showVerticalLines, verticalLinesProps = _h.verticalLinesProps;
|
|
32
32
|
useEffect(function () {
|
|
33
33
|
if (pointerConfig && getPointerProps) {
|
|
34
34
|
getPointerProps({ pointerIndex: pointerIndex, pointerX: pointerX, pointerY: pointerY });
|
|
@@ -97,9 +97,11 @@ var BarAndLineChartsWrapper = function (props) {
|
|
|
97
97
|
position: 'absolute',
|
|
98
98
|
bottom: chartType === chartTypes.LINE_BI_COLOR ? 0 : xAxisThickness,
|
|
99
99
|
},
|
|
100
|
-
!!props.width
|
|
100
|
+
(!!props.width || chartType === chartTypes.BUBBLE) && {
|
|
101
|
+
width: ((_d = props.width) !== null && _d !== void 0 ? _d : totalWidth) + extraWidthDueToDataPoint,
|
|
102
|
+
},
|
|
101
103
|
horizontal && {
|
|
102
|
-
width: ((
|
|
104
|
+
width: ((_e = props.width) !== null && _e !== void 0 ? _e : totalWidth) + (props.width ? endSpacing : -20),
|
|
103
105
|
},
|
|
104
106
|
], contentContainerStyle: [
|
|
105
107
|
{
|
|
@@ -107,7 +109,7 @@ var BarAndLineChartsWrapper = function (props) {
|
|
|
107
109
|
yAxisExtraHeight +
|
|
108
110
|
labelsExtraHeight +
|
|
109
111
|
(50 + xAxisLabelsVerticalShift),
|
|
110
|
-
width: Math.max((
|
|
112
|
+
width: Math.max((_f = props.width) !== null && _f !== void 0 ? _f : 0, totalWidth - spacing + endSpacing) +
|
|
111
113
|
extraWidthDueToDataPoint,
|
|
112
114
|
paddingLeft: initialSpacing,
|
|
113
115
|
paddingBottom: noOfSectionsBelowXAxis * stepHeight + labelsExtraHeight,
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.74",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar, Population Pyramid, Radar and Bubble charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"registry": "https://registry.npmjs.org/"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"gifted-charts-core": "0.1.
|
|
29
|
+
"gifted-charts-core": "0.1.78"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/cli": "^7.24.8",
|