react-native-gifted-charts 1.4.75 → 1.4.77
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 +21 -11
- package/dist/BubbleChart/index.js +34 -27
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +3 -1
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +3 -3
- package/dist/LineChart/index.js +5 -6
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<img src="/demos/redditLogo.png" height="auto" width="32" height="32" />
|
|
21
21
|
</a>
|
|
22
22
|
</p>
|
|
23
|
-
The most loved library for Bar, Line, Area, Pie, Donut, Stacked Bar, Population Pyramid, Radar and
|
|
23
|
+
The most loved library for Bar, Line, Area, Pie, Donut, Stacked Bar, Population Pyramid, Radar, Bubble and Scatter charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.
|
|
24
24
|
|
|
25
25
|
### Yet another chart library? Why?
|
|
26
26
|
|
|
@@ -44,24 +44,24 @@ The exact same piece of code that you write to render charts in react-native, ca
|
|
|
44
44
|
|
|
45
45
|
See the **[release changes by version here.](release-notes/release-notes.md)**
|
|
46
46
|
|
|
47
|
-
<img src='/demos/bars.png' alt=''/>
|
|
48
|
-
<img src='/demos/lineArea.png' alt=''/>
|
|
49
|
-
<img src='/demos/blues.png' alt=''/>
|
|
47
|
+
<img src='/demos/bars.png' alt='Bar Chart'/>
|
|
48
|
+
<img src='/demos/lineArea.png' alt='Line and Area Chart'/>
|
|
49
|
+
<img src='/demos/blues.png' alt='Bar and Pie Chart'/>
|
|
50
50
|
<table>
|
|
51
51
|
<tr>
|
|
52
|
-
<td><img src='/demos/scrollLine.gif' alt='' width=320 height=280/></td>
|
|
53
|
-
<td><img src='/demos/animatedDataLine.gif' alt='' width=320 height=260/></td>
|
|
52
|
+
<td><img src='/demos/scrollLine.gif' alt='Area Chart with Pointer' width=320 height=280/></td>
|
|
53
|
+
<td><img src='/demos/animatedDataLine.gif' alt='Area Chart with Changing Data' width=320 height=260/></td>
|
|
54
54
|
</tr>
|
|
55
55
|
|
|
56
56
|
<tr>
|
|
57
|
-
<td><img src='/demos/crossHair.gif' alt='' height=280 /></td>
|
|
58
|
-
<td><img src='/demos/
|
|
57
|
+
<td><img src='/demos/crossHair.gif' alt='Area Chart with Crosshair' height=280 /></td>
|
|
58
|
+
<td><img src='/demos/bubble.png' alt='Bubble Chart' height=280/></td>
|
|
59
59
|
<tr>
|
|
60
|
-
<td><img src='/demos/radar.png' alt='' height=280 width=320/></td>
|
|
61
|
-
<td><img src='/demos/ppnLabelled.png' alt='' height=280 width=300/></td>
|
|
60
|
+
<td><img src='/demos/radar.png' alt='Radar Chart' height=280 width=320/></td>
|
|
61
|
+
<td><img src='/demos/ppnLabelled.png' alt='Population Pyramid Chart' height=280 width=300/></td>
|
|
62
62
|
</tr>
|
|
63
63
|
</table>
|
|
64
|
-
<img src='/demos/pieExt.png' alt='' height=280 />
|
|
64
|
+
<img src='/demos/pieExt.png' alt='Donut Chart with External Labels' height=280 />
|
|
65
65
|
|
|
66
66
|
---
|
|
67
67
|
|
|
@@ -120,6 +120,16 @@ const data=[ {value:50}, {value:80}, {value:90}, {value:70} ]
|
|
|
120
120
|
// For Donut chart, just add the prop donut to the <PieChart/> component
|
|
121
121
|
|
|
122
122
|
<PieChart data = {data} donut />
|
|
123
|
+
|
|
124
|
+
// For Scatter chart, just add the prop scatterChart to the <BubbleChart/> component
|
|
125
|
+
|
|
126
|
+
<BubbleChart
|
|
127
|
+
data = {[
|
|
128
|
+
{x: 20, y: 4, r: 10},
|
|
129
|
+
{x: 40, y: 6, r: 20},
|
|
130
|
+
]}
|
|
131
|
+
scatterChart
|
|
132
|
+
/>
|
|
123
133
|
```
|
|
124
134
|
|
|
125
135
|
## Props tables
|
|
@@ -39,8 +39,8 @@ export var BubbleChart = function (props) {
|
|
|
39
39
|
var _a, _b, _c, _d;
|
|
40
40
|
var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
41
41
|
var pointsOpacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
42
|
-
var secondaryXAxis = props.secondaryXAxis, xAxisLabelTextStyle = props.xAxisLabelTextStyle, formatBubbleLabel = props.formatBubbleLabel;
|
|
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, labelMaxLength = _e.labelMaxLength, 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, regressionLineCoordinates = _e.regressionLineCoordinates, regressionLineConfig = _e.regressionLineConfig, regressionLineConfigs = _e.regressionLineConfigs, scatterChart = _e.scatterChart, maxRadius = _e.maxRadius, minRadius = _e.minRadius, extraWidthDueToBubble = _e.extraWidthDueToBubble, showGradient = _e.showGradient, centerColorForGradient = _e.centerColorForGradient;
|
|
42
|
+
var secondaryXAxis = props.secondaryXAxis, xAxisLabelTextStyle = props.xAxisLabelTextStyle, formatBubbleLabel = props.formatBubbleLabel, regressionLinesBehindBubbles = props.regressionLinesBehindBubbles;
|
|
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, labelMaxLength = _e.labelMaxLength, 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, regressionLineCoordinates = _e.regressionLineCoordinates, regressionLineConfig = _e.regressionLineConfig, regressionLineConfigs = _e.regressionLineConfigs, scatterChart = _e.scatterChart, maxRadius = _e.maxRadius, minRadius = _e.minRadius, extraWidthDueToBubble = _e.extraWidthDueToBubble, showGradient = _e.showGradient, centerColorForGradient = _e.centerColorForGradient, disableForeignObject = _e.disableForeignObject;
|
|
44
44
|
var progress = useRef(new Animated.Value(0)).current;
|
|
45
45
|
var AnimatedRegressionLineX = useRef(new Animated.Value(0)).current;
|
|
46
46
|
var AnimatedRegressionLineY = useRef(new Animated.Value(0)).current;
|
|
@@ -157,7 +157,7 @@ export var BubbleChart = function (props) {
|
|
|
157
157
|
regressionLineX2,
|
|
158
158
|
regressionLineY1,
|
|
159
159
|
regressionLineY2,
|
|
160
|
-
regressionLineConfigs,
|
|
160
|
+
// regressionLineConfigs,
|
|
161
161
|
regressionLineCoordinates,
|
|
162
162
|
animatedRegressionLineXValues,
|
|
163
163
|
animatedRegressionLineYValues,
|
|
@@ -238,8 +238,8 @@ export var BubbleChart = function (props) {
|
|
|
238
238
|
isAnimated,
|
|
239
239
|
bubblesShape,
|
|
240
240
|
regressionLineConfig.isAnimated,
|
|
241
|
-
regressionLineConfigs,
|
|
242
|
-
drawRegressionLine,
|
|
241
|
+
// regressionLineConfigs,
|
|
242
|
+
// drawRegressionLine,
|
|
243
243
|
]);
|
|
244
244
|
var svgHeight = containerHeightIncludingBelowXAxis + ((_c = props.overflowBottom) !== null && _c !== void 0 ? _c : 0);
|
|
245
245
|
// const onStripPress = (item: any, index: number) => {
|
|
@@ -262,7 +262,7 @@ export var BubbleChart = function (props) {
|
|
|
262
262
|
? containerHeight +
|
|
263
263
|
60 +
|
|
264
264
|
((_a = secondaryXAxis === null || secondaryXAxis === void 0 ? void 0 : secondaryXAxis.labelsDistanceFromXaxis) !== null && _a !== void 0 ? _a : 15)
|
|
265
|
-
: -xAxisTextNumberOfLines * 18 - (containerHeight - 200) / 20,
|
|
265
|
+
: -xAxisTextNumberOfLines * 18 - (containerHeight - 200) / 20 - 4,
|
|
266
266
|
zIndex: 10,
|
|
267
267
|
width: spacing + labelsExtraHeight,
|
|
268
268
|
left: left,
|
|
@@ -288,7 +288,7 @@ export var BubbleChart = function (props) {
|
|
|
288
288
|
((_b = secondaryXAxis === null || secondaryXAxis === void 0 ? void 0 : secondaryXAxis.labelsDistanceFromXaxis) !== null && _b !== void 0 ? _b : 15)
|
|
289
289
|
: rotateLabel
|
|
290
290
|
? 10
|
|
291
|
-
: -xAxisTextNumberOfLines * 18,
|
|
291
|
+
: -xAxisTextNumberOfLines * 18 - 4,
|
|
292
292
|
zIndex: 10,
|
|
293
293
|
width: spacing + labelsExtraHeight,
|
|
294
294
|
left: left,
|
|
@@ -300,7 +300,7 @@ export var BubbleChart = function (props) {
|
|
|
300
300
|
var renderBubbles = function (hideBubbles, dataForRender, originalDataFromProps, bubsShape, bubsWidth, bubsHeight, bubsColor, bubsRadius, labelFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText, key) {
|
|
301
301
|
var getYOrSecondaryY = getY; //isSecondary ? getSecondaryY : getY;
|
|
302
302
|
return dataForRender.map(function (item, index) {
|
|
303
|
-
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;
|
|
303
|
+
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;
|
|
304
304
|
// if (index < startIndex || index > endIndex) return null;
|
|
305
305
|
if (item.hideBubble) {
|
|
306
306
|
return null;
|
|
@@ -382,23 +382,24 @@ export var BubbleChart = function (props) {
|
|
|
382
382
|
? "url(#radial".concat(index, ")")
|
|
383
383
|
: dataPointsColor;
|
|
384
384
|
var localBorderColor = (_j = (_h = item.borderColor) !== null && _h !== void 0 ? _h : borderColor) !== null && _j !== void 0 ? _j : defaultBubbleColors[index % defaultBubbleColors.length];
|
|
385
|
+
var bubbleKey = "".concat(key, "-").concat((_k = item.indexUsedInDevForDataSet) !== null && _k !== void 0 ? _k : '', "-").concat((_l = item.label) !== null && _l !== void 0 ? _l : '', "-").concat(index);
|
|
385
386
|
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) {
|
|
386
387
|
var locationY = evt.nativeEvent.locationY; // Note that we have another property named pageY which can be useful
|
|
387
388
|
handleFocus(index);
|
|
388
|
-
}, onPressOut: handleUnFocus })) : null })) : null, hideBubbles ? null : (_jsxs(_Fragment, { children: [customBubble ? (isWebApp ? (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: getX((
|
|
389
|
+
}, onPressOut: handleUnFocus })) : null })) : null, hideBubbles ? null : (_jsxs(_Fragment, { children: [customBubble ? (isWebApp && !disableForeignObject ? (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: getX((_m = item.indexUsedInDevForDataSet) !== null && _m !== void 0 ? _m : index, index), y: getYOrSecondaryY(item.y) - bubblesHeight / 2, children: customBubble(item, index) })) : (_jsx(Animated.View, { style: {
|
|
389
390
|
position: 'absolute',
|
|
390
391
|
// height: svgHeight,
|
|
391
392
|
// width: totalWidth,
|
|
392
|
-
left: getX((
|
|
393
|
+
left: getX((_o = item.indexUsedInDevForDataSet) !== null && _o !== void 0 ? _o : index, index) -
|
|
393
394
|
bubblesWidth / 2,
|
|
394
395
|
top: getYOrSecondaryY(item.y) - bubblesHeight / 2,
|
|
395
396
|
opacity: isAnimated ? appearingOpacity : 1,
|
|
396
|
-
}, children: customBubble(item, index) }))) : null, bubblesShape === 'rectangular' ? (_jsx(Fragment, { children: customBubble ? null : (_jsx(AnimatedRect, { x: getX((
|
|
397
|
+
}, children: customBubble(item, index) }))) : null, bubblesShape === 'rectangular' ? (_jsx(Fragment, { children: customBubble ? null : (_jsx(AnimatedRect, { x: getX((_p = item.indexUsedInDevForDataSet) !== null && _p !== void 0 ? _p : index, index) -
|
|
397
398
|
bubblesWidth / 2, y: getYOrSecondaryY(item.y) - bubblesHeight / 2, width: isAnimated ? growingWidth[index] : bubblesWidth, height: isAnimated ? growingHeight[index] : bubblesHeight, opacity: isAnimated ? appearingDataPoints : opacity, fill: showBubbleOnFocus
|
|
398
399
|
? index === selectedIndex
|
|
399
400
|
? dataPointsColor
|
|
400
401
|
: 'none'
|
|
401
|
-
: dataPointsColor, fillOpacity: isAnimated ? appearingDataPoints : opacity, stroke: localBorderColor, strokeWidth: (
|
|
402
|
+
: dataPointsColor, fillOpacity: isAnimated ? appearingDataPoints : opacity, stroke: localBorderColor, strokeWidth: (_q = item.borderWidth) !== null && _q !== void 0 ? _q : borderWidth, strokeOpacity: (_s = (_r = item.borderOpacity) !== null && _r !== void 0 ? _r : props.borderOpacity) !== null && _s !== void 0 ? _s : (isAnimated ? appearingBorder : borderOpacity), onPress: function () {
|
|
402
403
|
item.onPress
|
|
403
404
|
? item.onPress(item, index)
|
|
404
405
|
: props.onPress
|
|
@@ -410,7 +411,7 @@ export var BubbleChart = function (props) {
|
|
|
410
411
|
if (!item.onPress && !props.onPress && focusEnabled) {
|
|
411
412
|
handleUnFocus();
|
|
412
413
|
}
|
|
413
|
-
} })) }, index)) : (_jsx(Fragment, { children: customBubble ? null : (_jsx(AnimatedCircle, { cx: getX((
|
|
414
|
+
} })) }, "rectBub-".concat(index))) : (_jsx(Fragment, { children: customBubble ? null : (_jsx(AnimatedCircle, { cx: getX((_t = item.indexUsedInDevForDataSet) !== null && _t !== void 0 ? _t : index, index), cy: getYOrSecondaryY(item.y), r: isAnimated ? growingRadii[index] : bubblesRadius, fill: ((_u = item.showGradient) !== null && _u !== void 0 ? _u : showGradient)
|
|
414
415
|
? isAndroid && isAnimated
|
|
415
416
|
? fillColorForAnimatedGradientOnAndroid
|
|
416
417
|
: "url(#radial".concat(index, ")")
|
|
@@ -420,7 +421,7 @@ export var BubbleChart = function (props) {
|
|
|
420
421
|
? opacity
|
|
421
422
|
: appearingDataPointsAndroid
|
|
422
423
|
: appearingDataPoints
|
|
423
|
-
: opacity, stroke: localBorderColor, strokeWidth: (
|
|
424
|
+
: opacity, stroke: localBorderColor, strokeWidth: (_v = item.borderWidth) !== null && _v !== void 0 ? _v : borderWidth, strokeOpacity: (_x = (_w = item.borderOpacity) !== null && _w !== void 0 ? _w : props.borderOpacity) !== null && _x !== void 0 ? _x : (isAnimated ? appearingBorder : borderOpacity), onPress: function () {
|
|
424
425
|
item.onPress
|
|
425
426
|
? item.onPress(item, index)
|
|
426
427
|
: props.onPress
|
|
@@ -432,7 +433,7 @@ export var BubbleChart = function (props) {
|
|
|
432
433
|
if (!item.onPress && !props.onPress && focusEnabled) {
|
|
433
434
|
handleUnFocus();
|
|
434
435
|
}
|
|
435
|
-
} })) }, index)), labelComponent ? (!showTextOnFocus || index === selectedIndex ? (isWebApp ? (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: getX((
|
|
436
|
+
} })) }, "bubble-".concat(index))), labelComponent ? (!showTextOnFocus || index === selectedIndex ? (isWebApp && !disableForeignObject ? (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: getX((_y = item.indexUsedInDevForDataSet) !== null && _y !== void 0 ? _y : index, index) -
|
|
436
437
|
labelWidth / 2 +
|
|
437
438
|
6 +
|
|
438
439
|
(item.labelShiftX || props.labelShiftX || 0), y: getYOrSecondaryY(item.y) -
|
|
@@ -447,7 +448,7 @@ export var BubbleChart = function (props) {
|
|
|
447
448
|
position: 'absolute',
|
|
448
449
|
height: svgHeight,
|
|
449
450
|
width: labelWidth,
|
|
450
|
-
left: getX((
|
|
451
|
+
left: getX((_z = item.indexUsedInDevForDataSet) !== null && _z !== void 0 ? _z : index, index) -
|
|
451
452
|
defaultFontSize / 2 +
|
|
452
453
|
(item.labelShiftX || props.labelShiftX || 0),
|
|
453
454
|
top: getYOrSecondaryY(item.y) -
|
|
@@ -460,24 +461,24 @@ export var BubbleChart = function (props) {
|
|
|
460
461
|
(focusTogether || key == selectedLineNumber)
|
|
461
462
|
? labelComponent(item, index) // not pushed in latest release
|
|
462
463
|
: null
|
|
463
|
-
: labelComponent(item, index) }))) : null) : formattedTextLabel ? (!showTextOnFocus || index === selectedIndex ? (isWebApp ? (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: getX((
|
|
464
|
+
: labelComponent(item, index) }))) : null) : formattedTextLabel ? (!showTextOnFocus || index === selectedIndex ? (isWebApp && !disableForeignObject ? (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: getX((_0 = item.indexUsedInDevForDataSet) !== null && _0 !== void 0 ? _0 : index, index) -
|
|
464
465
|
(formattedTextLabel.length * fontSize) / 4 +
|
|
465
466
|
(item.labelShiftX || props.labelShiftX || 0), y: getYOrSecondaryY(item.y) -
|
|
466
467
|
Math.max(10, fontSize / 1.5) +
|
|
467
468
|
(item.labelShiftY || props.labelShiftY || 0) -
|
|
468
|
-
(scatterChart ? bubblesRadius + 10 : 0), children: _jsx(Text, { style: __assign(__assign({}, textStyle), { fontSize: fontSize }), children: formattedTextLabel }) })) : (_jsx(Animated.Text, { style: __assign(__assign({}, textStyle), { position: 'absolute', left: getX((
|
|
469
|
+
(scatterChart ? bubblesRadius + 10 : 0), children: _jsx(Text, { style: __assign(__assign({}, textStyle), { fontSize: fontSize }), children: formattedTextLabel }) })) : (_jsx(Animated.Text, { style: __assign(__assign({}, textStyle), { position: 'absolute', left: getX((_1 = item.indexUsedInDevForDataSet) !== null && _1 !== void 0 ? _1 : index, index) -
|
|
469
470
|
(formattedTextLabel.length * fontSize) / 4 +
|
|
470
471
|
(item.labelShiftX || props.labelShiftX || 0), top: getYOrSecondaryY(item.y) -
|
|
471
472
|
fontSize / 1.5 +
|
|
472
473
|
(item.labelShiftY || props.labelShiftY || 0) -
|
|
473
474
|
(scatterChart ? bubblesRadius + 10 : 0), fontSize: fontSize, opacity: isAnimated
|
|
474
475
|
? appearingDataPoints
|
|
475
|
-
: ((
|
|
476
|
+
: ((_2 = textStyle.opacity) !== null && _2 !== void 0 ? _2 : 1) }), children: formattedTextLabel }))) : null) : null, index === selectedIndex ? _jsx(Text, { children: '' }) : null] }))] }, bubbleKey));
|
|
476
477
|
});
|
|
477
478
|
};
|
|
478
479
|
var svgWrapperViewStyle = {
|
|
479
480
|
position: 'absolute',
|
|
480
|
-
top:
|
|
481
|
+
top: xAxisLabelsVerticalShift, // 281 + xAxisLabelsVerticalShift + labelsExtraHeight - xAxisThickness,
|
|
481
482
|
left: 0,
|
|
482
483
|
zIndex: 1,
|
|
483
484
|
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
|
|
@@ -491,11 +492,14 @@ export var BubbleChart = function (props) {
|
|
|
491
492
|
// zIndex,
|
|
492
493
|
},
|
|
493
494
|
], 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) {
|
|
494
|
-
var _a;
|
|
495
|
-
|
|
495
|
+
var _a, _b, _c;
|
|
496
|
+
var gradientKey = "radial-gradient-".concat((_a = item.indexUsedInDevForDataSet) !== null && _a !== void 0 ? _a : '', "-").concat((_b = item.label) !== null && _b !== void 0 ? _b : '', "-").concat(index);
|
|
497
|
+
return (_jsxs(RadialGradient, { id: "radial".concat(index), cx: "50%", cy: "50%", r: "50%", children: [_jsx(Stop, { offset: "0%", stopColor: (_c = item.centerColorForGradient) !== null && _c !== void 0 ? _c : centerColorForGradient }), _jsx(Stop, { offset: "100%", stopColor: item.bubbleColor ||
|
|
496
498
|
bubblesColor ||
|
|
497
|
-
defaultBubbleColors[index % defaultBubbleColors.length] })] },
|
|
498
|
-
}) })),
|
|
499
|
+
defaultBubbleColors[index % defaultBubbleColors.length] })] }, gradientKey));
|
|
500
|
+
}) })), !regressionLinesBehindBubbles
|
|
501
|
+
? renderBubbles(hideBubbles, data, data, bubblesShape, bubblesWidth, bubblesHeight, bubblesColor, bubblesRadius, labelFontSize, startIndex, endIndex, false, showValuesAsBubbleLabels, 0)
|
|
502
|
+
: null, regressionLineConfigs.length ? (regressionLineConfigs.map(function (config, index) {
|
|
499
503
|
var _a = regressionLineCoordinates[index], regressionLineX1 = _a.regressionLineX1, regressionLineX2 = _a.regressionLineX2, regressionLineY1 = _a.regressionLineY1, regressionLineY2 = _a.regressionLineY2;
|
|
500
504
|
var animatedX = animatedRegressionLineXValues[index];
|
|
501
505
|
var animatedY = animatedRegressionLineYValues[index];
|
|
@@ -503,15 +507,18 @@ export var BubbleChart = function (props) {
|
|
|
503
507
|
? (animatedX !== null && animatedX !== void 0 ? animatedX : regressionLineX2)
|
|
504
508
|
: regressionLineX2, y2: config.isAnimated
|
|
505
509
|
? (animatedY !== null && animatedY !== void 0 ? animatedY : regressionLineY2)
|
|
506
|
-
: regressionLineY2, stroke: config.color, strokeOpacity: config.opacity, strokeWidth: config.thickness, strokeDasharray: config.strokeDashArray }));
|
|
510
|
+
: regressionLineY2, stroke: config.color, strokeOpacity: config.opacity, strokeWidth: config.thickness, strokeDasharray: config.strokeDashArray }, "regression-line-".concat(index)));
|
|
507
511
|
})) : showRegressionLine ? (_jsx(AnimatedLine, { x1: regressionLineX1, y1: regressionLineY1, x2: regressionLineConfig.isAnimated
|
|
508
512
|
? AnimatedRegressionLineX
|
|
509
513
|
: regressionLineX2, y2: regressionLineConfig.isAnimated
|
|
510
514
|
? AnimatedRegressionLineY
|
|
511
|
-
: regressionLineY2, stroke: regressionLineConfig.color, strokeOpacity: regressionLineConfig.opacity, strokeWidth: regressionLineConfig.thickness, strokeDasharray: regressionLineConfig.strokeDashArray })) : null
|
|
515
|
+
: regressionLineY2, stroke: regressionLineConfig.color, strokeOpacity: regressionLineConfig.opacity, strokeWidth: regressionLineConfig.thickness, strokeDasharray: regressionLineConfig.strokeDashArray })) : null, regressionLinesBehindBubbles
|
|
516
|
+
? renderBubbles(hideBubbles, data, data, bubblesShape, bubblesWidth, bubblesHeight, bubblesColor, bubblesRadius, labelFontSize, startIndex, endIndex, false, showValuesAsBubbleLabels, 0)
|
|
517
|
+
: null] }), xAxisLabelTexts === null || xAxisLabelTexts === void 0 ? void 0 : xAxisLabelTexts.map(function (label, index) {
|
|
518
|
+
var labelKey = "".concat(label, "-").concat(index);
|
|
512
519
|
return (_jsx(View, { children: isAnimated
|
|
513
520
|
? renderAnimatedLabel(false, index, label)
|
|
514
|
-
: renderLabel(false, index, label) },
|
|
521
|
+
: renderLabel(false, index, label) }, labelKey));
|
|
515
522
|
})] }));
|
|
516
523
|
};
|
|
517
524
|
var remainingScrollViewProps = {
|
|
@@ -7,7 +7,7 @@ import { renderSpecificDataPoints } from './renderSpecificDataPoints';
|
|
|
7
7
|
import { isIos, isWebApp } from '../../../utils';
|
|
8
8
|
var RenderLineInBarChart = function (props) {
|
|
9
9
|
var _a, _b;
|
|
10
|
-
var yAxisLabelWidth = props.yAxisLabelWidth, initialSpacing = props.initialSpacing, spacing = props.spacing, containerHeight = props.containerHeight, lineConfig = props.lineConfig, maxValue = props.maxValue, animatedWidth = props.animatedWidth, lineBehindBars = props.lineBehindBars, points = props.points, arrowPoints = props.arrowPoints, data = props.data, totalWidth = props.totalWidth, barWidth = props.barWidth, labelsExtraHeight = props.labelsExtraHeight, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, selectedIndex = props.selectedIndex, containerHeightIncludingBelowXAxis = props.containerHeightIncludingBelowXAxis, yAxisOffset = props.yAxisOffset, highlightEnabled = props.highlightEnabled, lowlightOpacity = props.lowlightOpacity;
|
|
10
|
+
var yAxisLabelWidth = props.yAxisLabelWidth, initialSpacing = props.initialSpacing, spacing = props.spacing, containerHeight = props.containerHeight, lineConfig = props.lineConfig, maxValue = props.maxValue, animatedWidth = props.animatedWidth, lineBehindBars = props.lineBehindBars, points = props.points, arrowPoints = props.arrowPoints, data = props.data, totalWidth = props.totalWidth, barWidth = props.barWidth, labelsExtraHeight = props.labelsExtraHeight, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, selectedIndex = props.selectedIndex, containerHeightIncludingBelowXAxis = props.containerHeightIncludingBelowXAxis, yAxisOffset = props.yAxisOffset, highlightEnabled = props.highlightEnabled, lowlightOpacity = props.lowlightOpacity, disableForeignObject = props.disableForeignObject;
|
|
11
11
|
var firstBarWidth = (_a = data[0].barWidth) !== null && _a !== void 0 ? _a : barWidth;
|
|
12
12
|
var opacity = highlightEnabled
|
|
13
13
|
? ((_b = selectedIndex.includes) === null || _b === void 0 ? void 0 : _b.call(selectedIndex, -1))
|
|
@@ -30,6 +30,7 @@ var RenderLineInBarChart = function (props) {
|
|
|
30
30
|
opacity: opacity,
|
|
31
31
|
svgHeight: svgHeight,
|
|
32
32
|
totalWidth: totalWidth,
|
|
33
|
+
disableForeignObject: disableForeignObject,
|
|
33
34
|
};
|
|
34
35
|
var specificVerticalLinesProps = {
|
|
35
36
|
data: data,
|
|
@@ -51,6 +52,7 @@ var RenderLineInBarChart = function (props) {
|
|
|
51
52
|
containerHeight: containerHeight,
|
|
52
53
|
maxValue: maxValue,
|
|
53
54
|
yAxisOffset: yAxisOffset,
|
|
55
|
+
disableForeignObject: disableForeignObject,
|
|
54
56
|
};
|
|
55
57
|
var renderAnimatedLine = function () {
|
|
56
58
|
var _a, _b, _c;
|
|
@@ -6,7 +6,7 @@ import { getXForLineInBar, getYForLineInBar } from 'gifted-charts-core';
|
|
|
6
6
|
import { Rect, Text as CanvasText, Circle, ForeignObject, } from 'react-native-svg';
|
|
7
7
|
import { isWebApp } from '../../../utils';
|
|
8
8
|
export var renderDataPoints = function (props) {
|
|
9
|
-
var data = props.data, lineConfig = props.lineConfig, barWidth = props.barWidth, containerHeight = props.containerHeight, maxValue = props.maxValue, firstBarWidth = props.firstBarWidth, yAxisLabelWidth = props.yAxisLabelWidth, spacing = props.spacing,
|
|
9
|
+
var data = props.data, lineConfig = props.lineConfig, barWidth = props.barWidth, containerHeight = props.containerHeight, maxValue = props.maxValue, firstBarWidth = props.firstBarWidth, yAxisLabelWidth = props.yAxisLabelWidth, spacing = props.spacing, yAxisOffset = props.yAxisOffset, opacity = props.opacity, svgHeight = props.svgHeight, totalWidth = props.totalWidth, disableForeignObject = props.disableForeignObject;
|
|
10
10
|
var focusEnabled = lineConfig.focusEnabled, dataPointLabelComponent = lineConfig.dataPointLabelComponent, showDataPointLabelOnFocus = lineConfig.showDataPointLabelOnFocus, focusedDataPointIndex = lineConfig.focusedDataPointIndex, setFocusedDataPointIndex = lineConfig.setFocusedDataPointIndex;
|
|
11
11
|
return (_jsxs(_Fragment, { children: [data.map(function (item, index) {
|
|
12
12
|
var _a, _b, _c;
|
|
@@ -34,7 +34,7 @@ export var renderDataPoints = function (props) {
|
|
|
34
34
|
height: lineConfig.dataPointsHeight,
|
|
35
35
|
width: lineConfig.dataPointsWidth,
|
|
36
36
|
top: containerHeight -
|
|
37
|
-
(value * containerHeight) / maxValue -
|
|
37
|
+
((value - yAxisOffset) * containerHeight) / maxValue -
|
|
38
38
|
((_c = (_b = item.shiftY) !== null && _b !== void 0 ? _b : lineConfig.shiftY) !== null && _c !== void 0 ? _c : 0),
|
|
39
39
|
left: getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing),
|
|
40
40
|
},
|
|
@@ -69,7 +69,7 @@ export var renderDataPoints = function (props) {
|
|
|
69
69
|
var value = (_a = item.value) !== null && _a !== void 0 ? _a : item.stacks.reduce(function (total, item) { return total + item.value; }, 0);
|
|
70
70
|
var x = getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing);
|
|
71
71
|
var y = getYForLineInBar(value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset);
|
|
72
|
-
if (isWebApp)
|
|
72
|
+
if (isWebApp && !disableForeignObject)
|
|
73
73
|
return (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: x - 12, y: y - 24, children: showDataPointLabelOnFocus
|
|
74
74
|
? focusedDataPointIndex === index
|
|
75
75
|
? dataPointLabelComponent === null || dataPointLabelComponent === void 0 ? void 0 : dataPointLabelComponent(item, index)
|
package/dist/LineChart/index.js
CHANGED
|
@@ -56,7 +56,7 @@ export var LineChart = function (props) {
|
|
|
56
56
|
var widthValue3 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
57
57
|
var widthValue4 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
58
58
|
var widthValue5 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
59
|
-
var _e = useLineChart(__assign(__assign({}, props), { parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), curveType = _e.curveType, scrollX = _e.scrollX, setScrollX = _e.setScrollX, arrow1Points = _e.arrow1Points, arrow2Points = _e.arrow2Points, arrow3Points = _e.arrow3Points, arrow4Points = _e.arrow4Points, arrow5Points = _e.arrow5Points, secondaryArrowPoints = _e.secondaryArrowPoints, pointerIndex = _e.pointerIndex, setPointerIndex = _e.setPointerIndex, pointerX = _e.pointerX, setPointerX = _e.setPointerX, pointerY = _e.pointerY, setPointerY = _e.setPointerY, pointerItem = _e.pointerItem, setPointerItem = _e.setPointerItem, pointerY2 = _e.pointerY2, setPointerY2 = _e.setPointerY2, pointerItem2 = _e.pointerItem2, setPointerItem2 = _e.setPointerItem2, pointerY3 = _e.pointerY3, setPointerY3 = _e.setPointerY3, pointerItem3 = _e.pointerItem3, setPointerItem3 = _e.setPointerItem3, pointerY4 = _e.pointerY4, setPointerY4 = _e.setPointerY4, pointerItem4 = _e.pointerItem4, setPointerItem4 = _e.setPointerItem4, pointerY5 = _e.pointerY5, setPointerY5 = _e.setPointerY5, pointerYsForDataSet = _e.pointerYsForDataSet, setPointerYsForDataSet = _e.setPointerYsForDataSet, pointerItem5 = _e.pointerItem5, setPointerItem5 = _e.setPointerItem5, secondaryPointerY = _e.secondaryPointerY, setSecondaryPointerY = _e.setSecondaryPointerY, secondaryPointerItem = _e.secondaryPointerItem, setSecondaryPointerItem = _e.setSecondaryPointerItem, pointerItemsForSet = _e.pointerItemsForSet, setPointerItemsForSet = _e.setPointerItemsForSet, secondaryPointerItemsForSet = _e.secondaryPointerItemsForSet, setSecondaryPointerItemsForSet = _e.setSecondaryPointerItemsForSet, responderStartTime = _e.responderStartTime, setResponderStartTime = _e.setResponderStartTime, setResponderActive = _e.setResponderActive, points = _e.points, points2 = _e.points2, points3 = _e.points3, points4 = _e.points4, points5 = _e.points5, secondaryPoints = _e.secondaryPoints, fillPoints = _e.fillPoints, fillPoints2 = _e.fillPoints2, fillPoints3 = _e.fillPoints3, fillPoints4 = _e.fillPoints4, fillPoints5 = _e.fillPoints5, secondaryFillPoints = _e.secondaryFillPoints, pointsFromSet = _e.pointsFromSet, fillPointsFromSet = _e.fillPointsFromSet, arrowPointsFromSet = _e.arrowPointsFromSet, selectedIndex = _e.selectedIndex, setSelectedIndex = _e.setSelectedIndex, containerHeight = _e.containerHeight, data = _e.data, data2 = _e.data2, data3 = _e.data3, data4 = _e.data4, data5 = _e.data5, secondaryData = _e.secondaryData, dataSet = _e.dataSet, data0 = _e.data0, labelsExtraHeight = _e.labelsExtraHeight, animationDuration = _e.animationDuration, onDataChangeAnimationDuration = _e.onDataChangeAnimationDuration, animateTogether = _e.animateTogether, renderDataPointsAfterAnimationEnds = _e.renderDataPointsAfterAnimationEnds, animateOnDataChange = _e.animateOnDataChange, startIndex1 = _e.startIndex1, startIndex2 = _e.startIndex2, endIndex1 = _e.endIndex1, endIndex2 = _e.endIndex2, startIndex3 = _e.startIndex3, endIndex3 = _e.endIndex3, startIndex4 = _e.startIndex4, endIndex4 = _e.endIndex4, startIndex5 = _e.startIndex5, endIndex5 = _e.endIndex5, initialSpacing = _e.initialSpacing, thickness = _e.thickness, yAxisLabelWidth = _e.yAxisLabelWidth, spacing = _e.spacing, xAxisThickness = _e.xAxisThickness, dataPointsHeight1 = _e.dataPointsHeight1, dataPointsWidth1 = _e.dataPointsWidth1, dataPointsRadius1 = _e.dataPointsRadius1, dataPointsColor1 = _e.dataPointsColor1, dataPointsShape1 = _e.dataPointsShape1, dataPointsHeight2 = _e.dataPointsHeight2, dataPointsWidth2 = _e.dataPointsWidth2, dataPointsRadius2 = _e.dataPointsRadius2, dataPointsColor2 = _e.dataPointsColor2, dataPointsShape2 = _e.dataPointsShape2, dataPointsHeight3 = _e.dataPointsHeight3, dataPointsWidth3 = _e.dataPointsWidth3, dataPointsRadius3 = _e.dataPointsRadius3, dataPointsColor3 = _e.dataPointsColor3, dataPointsShape3 = _e.dataPointsShape3, dataPointsHeight4 = _e.dataPointsHeight4, dataPointsWidth4 = _e.dataPointsWidth4, dataPointsRadius4 = _e.dataPointsRadius4, dataPointsColor4 = _e.dataPointsColor4, dataPointsShape4 = _e.dataPointsShape4, dataPointsHeight5 = _e.dataPointsHeight5, dataPointsWidth5 = _e.dataPointsWidth5, dataPointsRadius5 = _e.dataPointsRadius5, dataPointsColor5 = _e.dataPointsColor5, dataPointsShape5 = _e.dataPointsShape5, getIsNthAreaChart = _e.getIsNthAreaChart, textFontSize1 = _e.textFontSize1, textFontSize2 = _e.textFontSize2, textFontSize3 = _e.textFontSize3, textFontSize4 = _e.textFontSize4, textFontSize5 = _e.textFontSize5, textColor1 = _e.textColor1, textColor2 = _e.textColor2, textColor3 = _e.textColor3, textColor4 = _e.textColor4, textColor5 = _e.textColor5, totalWidth = _e.totalWidth, maxValue = _e.maxValue, overflowTop = _e.overflowTop, extendedContainerHeight = _e.extendedContainerHeight, getX = _e.getX, getY = _e.getY, getSecondaryY = _e.getSecondaryY, secondaryMaxValue = _e.secondaryMaxValue, showValuesAsDataPointsText = _e.showValuesAsDataPointsText, thickness1 = _e.thickness1, thickness2 = _e.thickness2, thickness3 = _e.thickness3, thickness4 = _e.thickness4, thickness5 = _e.thickness5, zIndex1 = _e.zIndex1, zIndex2 = _e.zIndex2, zIndex3 = _e.zIndex3, zIndex4 = _e.zIndex4, zIndex5 = _e.zIndex5, strokeDashArray1 = _e.strokeDashArray1, strokeDashArray2 = _e.strokeDashArray2, strokeDashArray3 = _e.strokeDashArray3, strokeDashArray4 = _e.strokeDashArray4, strokeDashArray5 = _e.strokeDashArray5, strokeLinecap1 = _e.strokeLinecap1, strokeLinecap2 = _e.strokeLinecap2, strokeLinecap3 = _e.strokeLinecap3, strokeLinecap4 = _e.strokeLinecap4, strokeLinecap5 = _e.strokeLinecap5, rotateLabel = _e.rotateLabel, isAnimated = _e.isAnimated, hideDataPoints1 = _e.hideDataPoints1, hideDataPoints2 = _e.hideDataPoints2, hideDataPoints3 = _e.hideDataPoints3, hideDataPoints4 = _e.hideDataPoints4, hideDataPoints5 = _e.hideDataPoints5, color1 = _e.color1, color2 = _e.color2, color3 = _e.color3, color4 = _e.color4, color5 = _e.color5, startFillColor1 = _e.startFillColor1, endFillColor1 = _e.endFillColor1, startOpacity1 = _e.startOpacity1, endOpacity1 = _e.endOpacity1, startFillColor2 = _e.startFillColor2, endFillColor2 = _e.endFillColor2, startOpacity2 = _e.startOpacity2, endOpacity2 = _e.endOpacity2, startFillColor3 = _e.startFillColor3, endFillColor3 = _e.endFillColor3, startOpacity3 = _e.startOpacity3, endOpacity3 = _e.endOpacity3, startFillColor4 = _e.startFillColor4, endFillColor4 = _e.endFillColor4, startOpacity4 = _e.startOpacity4, endOpacity4 = _e.endOpacity4, startFillColor5 = _e.startFillColor5, endFillColor5 = _e.endFillColor5, startOpacity5 = _e.startOpacity5, endOpacity5 = _e.endOpacity5, arrowStrokeWidth1 = _e.arrowStrokeWidth1, arrowStrokeColor1 = _e.arrowStrokeColor1, arrowFillColor1 = _e.arrowFillColor1, arrowStrokeWidth2 = _e.arrowStrokeWidth2, arrowStrokeColor2 = _e.arrowStrokeColor2, arrowFillColor2 = _e.arrowFillColor2, arrowStrokeWidth3 = _e.arrowStrokeWidth3, arrowStrokeColor3 = _e.arrowStrokeColor3, arrowFillColor3 = _e.arrowFillColor3, arrowStrokeWidth4 = _e.arrowStrokeWidth4, arrowStrokeColor4 = _e.arrowStrokeColor4, arrowFillColor4 = _e.arrowFillColor4, arrowStrokeWidth5 = _e.arrowStrokeWidth5, arrowStrokeColor5 = _e.arrowStrokeColor5, arrowFillColor5 = _e.arrowFillColor5, arrowStrokeWidthsFromSet = _e.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _e.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _e.arrowFillColorsFromSet, secondaryLineConfig = _e.secondaryLineConfig, gradientDirection = _e.gradientDirection, stepHeight = _e.stepHeight, noOfSectionsBelowXAxis = _e.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _e.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _e.xAxisLabelsVerticalShift, pointerConfig = _e.pointerConfig, pointerHeight = _e.pointerHeight, pointerWidth = _e.pointerWidth, pointerRadius = _e.pointerRadius, pointerColor = _e.pointerColor, pointerComponent = _e.pointerComponent, showPointerStrip = _e.showPointerStrip, pointerStripHeight = _e.pointerStripHeight, pointerStripWidth = _e.pointerStripWidth, pointerStripColor = _e.pointerStripColor, pointerStripUptoDataPoint = _e.pointerStripUptoDataPoint, pointerLabelComponent = _e.pointerLabelComponent, stripOverPointer = _e.stripOverPointer, shiftPointerLabelX = _e.shiftPointerLabelX, shiftPointerLabelY = _e.shiftPointerLabelY, pointerLabelWidth = _e.pointerLabelWidth, pointerLabelHeight = _e.pointerLabelHeight, autoAdjustPointerLabelPosition = _e.autoAdjustPointerLabelPosition, pointerVanishDelay = _e.pointerVanishDelay, activatePointersOnLongPress = _e.activatePointersOnLongPress, activatePointersInstantlyOnTouch = _e.activatePointersInstantlyOnTouch, activatePointersDelay = _e.activatePointersDelay, persistPointer = _e.persistPointer, resetPointerIndexOnRelease = _e.resetPointerIndexOnRelease, hidePointers = _e.hidePointers, hidePointer1 = _e.hidePointer1, hidePointer2 = _e.hidePointer2, hidePointer3 = _e.hidePointer3, hidePointer4 = _e.hidePointer4, hidePointer5 = _e.hidePointer5, cumulativeSpacing1 = _e.cumulativeSpacing1, cumulativeSpacing2 = _e.cumulativeSpacing2, cumulativeSpacing3 = _e.cumulativeSpacing3, cumulativeSpacing4 = _e.cumulativeSpacing4, cumulativeSpacing5 = _e.cumulativeSpacing5, cumulativeSpacingSecondary = _e.cumulativeSpacingSecondary, cumulativeSpacingForSet = _e.cumulativeSpacingForSet, hideSecondaryPointer = _e.hideSecondaryPointer, hidePointerDataPointForMissingValues = _e.hidePointerDataPointForMissingValues, pointerEvents = _e.pointerEvents, focusEnabled = _e.focusEnabled, showDataPointOnFocus = _e.showDataPointOnFocus, showStripOnFocus = _e.showStripOnFocus, stripOverDataPoints = _e.stripOverDataPoints, showTextOnFocus = _e.showTextOnFocus, showDataPointLabelOnFocus = _e.showDataPointLabelOnFocus, stripHeight = _e.stripHeight, stripWidth = _e.stripWidth, stripColor = _e.stripColor, stripOpacity = _e.stripOpacity, stripStrokeDashArray = _e.stripStrokeDashArray, _f = _e.containerHeightIncludingBelowXAxis, containerHeightIncludingBelowXAxis = _f === void 0 ? 0 : _f, lineGradient = _e.lineGradient, lineGradientDirection = _e.lineGradientDirection, lineGradientStartColor = _e.lineGradientStartColor, lineGradientEndColor = _e.lineGradientEndColor, barAndLineChartsWrapperProps = _e.barAndLineChartsWrapperProps, areaChart = _e.areaChart, mostNegativeValue = _e.mostNegativeValue, strips = _e.strips, lastLineNumber = _e.lastLineNumber, focusTogether = _e.focusTogether, selectedLineNumber = _e.selectedLineNumber, handleFocus = _e.handleFocus, handleUnFocus = _e.handleUnFocus, stepValue = _e.stepValue, pointerItemLocal = _e.pointerItemLocal, allowFontScaling = _e.allowFontScaling, colors = _e.colors;
|
|
59
|
+
var _e = useLineChart(__assign(__assign({}, props), { parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), curveType = _e.curveType, scrollX = _e.scrollX, setScrollX = _e.setScrollX, arrow1Points = _e.arrow1Points, arrow2Points = _e.arrow2Points, arrow3Points = _e.arrow3Points, arrow4Points = _e.arrow4Points, arrow5Points = _e.arrow5Points, secondaryArrowPoints = _e.secondaryArrowPoints, pointerIndex = _e.pointerIndex, setPointerIndex = _e.setPointerIndex, pointerX = _e.pointerX, setPointerX = _e.setPointerX, pointerY = _e.pointerY, setPointerY = _e.setPointerY, pointerItem = _e.pointerItem, setPointerItem = _e.setPointerItem, pointerY2 = _e.pointerY2, setPointerY2 = _e.setPointerY2, pointerItem2 = _e.pointerItem2, setPointerItem2 = _e.setPointerItem2, pointerY3 = _e.pointerY3, setPointerY3 = _e.setPointerY3, pointerItem3 = _e.pointerItem3, setPointerItem3 = _e.setPointerItem3, pointerY4 = _e.pointerY4, setPointerY4 = _e.setPointerY4, pointerItem4 = _e.pointerItem4, setPointerItem4 = _e.setPointerItem4, pointerY5 = _e.pointerY5, setPointerY5 = _e.setPointerY5, pointerYsForDataSet = _e.pointerYsForDataSet, setPointerYsForDataSet = _e.setPointerYsForDataSet, pointerItem5 = _e.pointerItem5, setPointerItem5 = _e.setPointerItem5, secondaryPointerY = _e.secondaryPointerY, setSecondaryPointerY = _e.setSecondaryPointerY, secondaryPointerItem = _e.secondaryPointerItem, setSecondaryPointerItem = _e.setSecondaryPointerItem, pointerItemsForSet = _e.pointerItemsForSet, setPointerItemsForSet = _e.setPointerItemsForSet, secondaryPointerItemsForSet = _e.secondaryPointerItemsForSet, setSecondaryPointerItemsForSet = _e.setSecondaryPointerItemsForSet, responderStartTime = _e.responderStartTime, setResponderStartTime = _e.setResponderStartTime, setResponderActive = _e.setResponderActive, points = _e.points, points2 = _e.points2, points3 = _e.points3, points4 = _e.points4, points5 = _e.points5, secondaryPoints = _e.secondaryPoints, fillPoints = _e.fillPoints, fillPoints2 = _e.fillPoints2, fillPoints3 = _e.fillPoints3, fillPoints4 = _e.fillPoints4, fillPoints5 = _e.fillPoints5, secondaryFillPoints = _e.secondaryFillPoints, pointsFromSet = _e.pointsFromSet, fillPointsFromSet = _e.fillPointsFromSet, arrowPointsFromSet = _e.arrowPointsFromSet, selectedIndex = _e.selectedIndex, setSelectedIndex = _e.setSelectedIndex, containerHeight = _e.containerHeight, data = _e.data, data2 = _e.data2, data3 = _e.data3, data4 = _e.data4, data5 = _e.data5, secondaryData = _e.secondaryData, dataSet = _e.dataSet, data0 = _e.data0, labelsExtraHeight = _e.labelsExtraHeight, animationDuration = _e.animationDuration, onDataChangeAnimationDuration = _e.onDataChangeAnimationDuration, animateTogether = _e.animateTogether, renderDataPointsAfterAnimationEnds = _e.renderDataPointsAfterAnimationEnds, animateOnDataChange = _e.animateOnDataChange, startIndex1 = _e.startIndex1, startIndex2 = _e.startIndex2, endIndex1 = _e.endIndex1, endIndex2 = _e.endIndex2, startIndex3 = _e.startIndex3, endIndex3 = _e.endIndex3, startIndex4 = _e.startIndex4, endIndex4 = _e.endIndex4, startIndex5 = _e.startIndex5, endIndex5 = _e.endIndex5, initialSpacing = _e.initialSpacing, thickness = _e.thickness, yAxisLabelWidth = _e.yAxisLabelWidth, spacing = _e.spacing, xAxisThickness = _e.xAxisThickness, dataPointsHeight1 = _e.dataPointsHeight1, dataPointsWidth1 = _e.dataPointsWidth1, dataPointsRadius1 = _e.dataPointsRadius1, dataPointsColor1 = _e.dataPointsColor1, dataPointsShape1 = _e.dataPointsShape1, dataPointsHeight2 = _e.dataPointsHeight2, dataPointsWidth2 = _e.dataPointsWidth2, dataPointsRadius2 = _e.dataPointsRadius2, dataPointsColor2 = _e.dataPointsColor2, dataPointsShape2 = _e.dataPointsShape2, dataPointsHeight3 = _e.dataPointsHeight3, dataPointsWidth3 = _e.dataPointsWidth3, dataPointsRadius3 = _e.dataPointsRadius3, dataPointsColor3 = _e.dataPointsColor3, dataPointsShape3 = _e.dataPointsShape3, dataPointsHeight4 = _e.dataPointsHeight4, dataPointsWidth4 = _e.dataPointsWidth4, dataPointsRadius4 = _e.dataPointsRadius4, dataPointsColor4 = _e.dataPointsColor4, dataPointsShape4 = _e.dataPointsShape4, dataPointsHeight5 = _e.dataPointsHeight5, dataPointsWidth5 = _e.dataPointsWidth5, dataPointsRadius5 = _e.dataPointsRadius5, dataPointsColor5 = _e.dataPointsColor5, dataPointsShape5 = _e.dataPointsShape5, getIsNthAreaChart = _e.getIsNthAreaChart, textFontSize1 = _e.textFontSize1, textFontSize2 = _e.textFontSize2, textFontSize3 = _e.textFontSize3, textFontSize4 = _e.textFontSize4, textFontSize5 = _e.textFontSize5, textColor1 = _e.textColor1, textColor2 = _e.textColor2, textColor3 = _e.textColor3, textColor4 = _e.textColor4, textColor5 = _e.textColor5, totalWidth = _e.totalWidth, maxValue = _e.maxValue, overflowTop = _e.overflowTop, extendedContainerHeight = _e.extendedContainerHeight, getX = _e.getX, getY = _e.getY, getSecondaryY = _e.getSecondaryY, secondaryMaxValue = _e.secondaryMaxValue, showValuesAsDataPointsText = _e.showValuesAsDataPointsText, thickness1 = _e.thickness1, thickness2 = _e.thickness2, thickness3 = _e.thickness3, thickness4 = _e.thickness4, thickness5 = _e.thickness5, zIndex1 = _e.zIndex1, zIndex2 = _e.zIndex2, zIndex3 = _e.zIndex3, zIndex4 = _e.zIndex4, zIndex5 = _e.zIndex5, strokeDashArray1 = _e.strokeDashArray1, strokeDashArray2 = _e.strokeDashArray2, strokeDashArray3 = _e.strokeDashArray3, strokeDashArray4 = _e.strokeDashArray4, strokeDashArray5 = _e.strokeDashArray5, strokeLinecap1 = _e.strokeLinecap1, strokeLinecap2 = _e.strokeLinecap2, strokeLinecap3 = _e.strokeLinecap3, strokeLinecap4 = _e.strokeLinecap4, strokeLinecap5 = _e.strokeLinecap5, rotateLabel = _e.rotateLabel, isAnimated = _e.isAnimated, hideDataPoints1 = _e.hideDataPoints1, hideDataPoints2 = _e.hideDataPoints2, hideDataPoints3 = _e.hideDataPoints3, hideDataPoints4 = _e.hideDataPoints4, hideDataPoints5 = _e.hideDataPoints5, color1 = _e.color1, color2 = _e.color2, color3 = _e.color3, color4 = _e.color4, color5 = _e.color5, startFillColor1 = _e.startFillColor1, endFillColor1 = _e.endFillColor1, startOpacity1 = _e.startOpacity1, endOpacity1 = _e.endOpacity1, startFillColor2 = _e.startFillColor2, endFillColor2 = _e.endFillColor2, startOpacity2 = _e.startOpacity2, endOpacity2 = _e.endOpacity2, startFillColor3 = _e.startFillColor3, endFillColor3 = _e.endFillColor3, startOpacity3 = _e.startOpacity3, endOpacity3 = _e.endOpacity3, startFillColor4 = _e.startFillColor4, endFillColor4 = _e.endFillColor4, startOpacity4 = _e.startOpacity4, endOpacity4 = _e.endOpacity4, startFillColor5 = _e.startFillColor5, endFillColor5 = _e.endFillColor5, startOpacity5 = _e.startOpacity5, endOpacity5 = _e.endOpacity5, arrowStrokeWidth1 = _e.arrowStrokeWidth1, arrowStrokeColor1 = _e.arrowStrokeColor1, arrowFillColor1 = _e.arrowFillColor1, arrowStrokeWidth2 = _e.arrowStrokeWidth2, arrowStrokeColor2 = _e.arrowStrokeColor2, arrowFillColor2 = _e.arrowFillColor2, arrowStrokeWidth3 = _e.arrowStrokeWidth3, arrowStrokeColor3 = _e.arrowStrokeColor3, arrowFillColor3 = _e.arrowFillColor3, arrowStrokeWidth4 = _e.arrowStrokeWidth4, arrowStrokeColor4 = _e.arrowStrokeColor4, arrowFillColor4 = _e.arrowFillColor4, arrowStrokeWidth5 = _e.arrowStrokeWidth5, arrowStrokeColor5 = _e.arrowStrokeColor5, arrowFillColor5 = _e.arrowFillColor5, arrowStrokeWidthsFromSet = _e.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _e.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _e.arrowFillColorsFromSet, secondaryLineConfig = _e.secondaryLineConfig, gradientDirection = _e.gradientDirection, stepHeight = _e.stepHeight, noOfSectionsBelowXAxis = _e.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _e.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _e.xAxisLabelsVerticalShift, pointerConfig = _e.pointerConfig, pointerHeight = _e.pointerHeight, pointerWidth = _e.pointerWidth, pointerRadius = _e.pointerRadius, pointerColor = _e.pointerColor, pointerComponent = _e.pointerComponent, showPointerStrip = _e.showPointerStrip, pointerStripHeight = _e.pointerStripHeight, pointerStripWidth = _e.pointerStripWidth, pointerStripColor = _e.pointerStripColor, pointerStripUptoDataPoint = _e.pointerStripUptoDataPoint, pointerLabelComponent = _e.pointerLabelComponent, stripOverPointer = _e.stripOverPointer, shiftPointerLabelX = _e.shiftPointerLabelX, shiftPointerLabelY = _e.shiftPointerLabelY, pointerLabelWidth = _e.pointerLabelWidth, pointerLabelHeight = _e.pointerLabelHeight, autoAdjustPointerLabelPosition = _e.autoAdjustPointerLabelPosition, pointerVanishDelay = _e.pointerVanishDelay, activatePointersOnLongPress = _e.activatePointersOnLongPress, activatePointersInstantlyOnTouch = _e.activatePointersInstantlyOnTouch, activatePointersDelay = _e.activatePointersDelay, persistPointer = _e.persistPointer, resetPointerIndexOnRelease = _e.resetPointerIndexOnRelease, hidePointers = _e.hidePointers, hidePointer1 = _e.hidePointer1, hidePointer2 = _e.hidePointer2, hidePointer3 = _e.hidePointer3, hidePointer4 = _e.hidePointer4, hidePointer5 = _e.hidePointer5, cumulativeSpacing1 = _e.cumulativeSpacing1, cumulativeSpacing2 = _e.cumulativeSpacing2, cumulativeSpacing3 = _e.cumulativeSpacing3, cumulativeSpacing4 = _e.cumulativeSpacing4, cumulativeSpacing5 = _e.cumulativeSpacing5, cumulativeSpacingSecondary = _e.cumulativeSpacingSecondary, cumulativeSpacingForSet = _e.cumulativeSpacingForSet, hideSecondaryPointer = _e.hideSecondaryPointer, hidePointerDataPointForMissingValues = _e.hidePointerDataPointForMissingValues, pointerEvents = _e.pointerEvents, focusEnabled = _e.focusEnabled, showDataPointOnFocus = _e.showDataPointOnFocus, showStripOnFocus = _e.showStripOnFocus, stripOverDataPoints = _e.stripOverDataPoints, showTextOnFocus = _e.showTextOnFocus, showDataPointLabelOnFocus = _e.showDataPointLabelOnFocus, stripHeight = _e.stripHeight, stripWidth = _e.stripWidth, stripColor = _e.stripColor, stripOpacity = _e.stripOpacity, stripStrokeDashArray = _e.stripStrokeDashArray, _f = _e.containerHeightIncludingBelowXAxis, containerHeightIncludingBelowXAxis = _f === void 0 ? 0 : _f, lineGradient = _e.lineGradient, lineGradientDirection = _e.lineGradientDirection, lineGradientStartColor = _e.lineGradientStartColor, lineGradientEndColor = _e.lineGradientEndColor, barAndLineChartsWrapperProps = _e.barAndLineChartsWrapperProps, areaChart = _e.areaChart, mostNegativeValue = _e.mostNegativeValue, strips = _e.strips, lastLineNumber = _e.lastLineNumber, focusTogether = _e.focusTogether, selectedLineNumber = _e.selectedLineNumber, handleFocus = _e.handleFocus, handleUnFocus = _e.handleUnFocus, pointerItemLocal = _e.pointerItemLocal, allowFontScaling = _e.allowFontScaling, colors = _e.colors, disableForeignObject = _e.disableForeignObject;
|
|
60
60
|
var svgHeight = containerHeightIncludingBelowXAxis +
|
|
61
61
|
((_c = props.overflowBottom) !== null && _c !== void 0 ? _c : dataPointsRadius1);
|
|
62
62
|
var secondaryXAxis = props.secondaryXAxis, intersectionAreaConfig = props.intersectionAreaConfig;
|
|
@@ -256,7 +256,6 @@ export var LineChart = function (props) {
|
|
|
256
256
|
props.onFocus(item, index);
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
|
-
// const [selectedLineNumber, setSelectedLineNumber] = useState(-1);
|
|
260
259
|
var renderDataPoints = function (hideDataPoints, dataForRender, originalDataFromProps, dataPtsShape, dataPtsWidth, dataPtsHeight, dataPtsColor, dataPtsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText, spacingArray, key) {
|
|
261
260
|
var getYOrSecondaryY = isSecondary ? getSecondaryY : getY;
|
|
262
261
|
return dataForRender.map(function (item, index) {
|
|
@@ -325,10 +324,10 @@ export var LineChart = function (props) {
|
|
|
325
324
|
: props.dataPointLabelWidth
|
|
326
325
|
? props.dataPointLabelWidth
|
|
327
326
|
: 30;
|
|
328
|
-
return (_jsxs(Fragment, { children: [focusEnabled ? (_jsx(_Fragment, { children: key === lastLineNumber - 1 ? (_jsx(Rect, { x: initialSpacing + (spacing * index - spacing / 2), y:
|
|
327
|
+
return (_jsxs(Fragment, { children: [focusEnabled ? (_jsx(_Fragment, { children: key === lastLineNumber - 1 ? (_jsx(Rect, { x: initialSpacing + (spacing * index - spacing / 2), y: 0, width: spacing, height: containerHeightIncludingBelowXAxis, fill: 'none', onPressIn: function (evt) {
|
|
329
328
|
var locationY = evt.nativeEvent.locationY; // Note that we have another property named pageY which can be useful
|
|
330
329
|
handleFocus(index, item, locationY, onStripPress);
|
|
331
|
-
}, onPressOut: handleUnFocus })) : null })) : null, hideDataPoints ? null : (_jsxs(_Fragment, { children: [customDataPoint ? (isWebApp ? (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: initialSpacing -
|
|
330
|
+
}, onPressOut: handleUnFocus })) : null })) : null, hideDataPoints ? null : (_jsxs(_Fragment, { children: [customDataPoint ? (isWebApp && !disableForeignObject ? (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: initialSpacing -
|
|
332
331
|
dataPointsWidth / 2 +
|
|
333
332
|
((_e = spacingArray[index - 1]) !== null && _e !== void 0 ? _e : 0), y: getYOrSecondaryY(item.value) - dataPointsHeight / 2, children: customDataPoint(item, index) })) : (_jsx(Animated.View, { style: {
|
|
334
333
|
position: 'absolute',
|
|
@@ -371,7 +370,7 @@ export var LineChart = function (props) {
|
|
|
371
370
|
if (!item.onPress && !props.onPress && focusEnabled) {
|
|
372
371
|
handleUnFocus();
|
|
373
372
|
}
|
|
374
|
-
} })) }, index)), dataPointLabelComponent ? (!showTextOnFocus || index === selectedIndex ? (isWebApp ? (_jsx(ForeignObject, { height: svgHeight, width: dataPointLabelWidth, x: initialSpacing +
|
|
373
|
+
} })) }, index)), dataPointLabelComponent ? (!showTextOnFocus || index === selectedIndex ? (isWebApp && !disableForeignObject ? (_jsx(ForeignObject, { height: svgHeight, width: dataPointLabelWidth, x: initialSpacing +
|
|
375
374
|
(item.dataPointLabelShiftX ||
|
|
376
375
|
props.dataPointLabelShiftX ||
|
|
377
376
|
0) -
|
|
@@ -761,7 +760,7 @@ export var LineChart = function (props) {
|
|
|
761
760
|
factor = Math.max(factor, 0);
|
|
762
761
|
var item, y;
|
|
763
762
|
item = (data0 !== null && data0 !== void 0 ? data0 : data)[factor];
|
|
764
|
-
if (!item.hidePointer) {
|
|
763
|
+
if (item && !item.hidePointer) {
|
|
765
764
|
var z = getX((dataSet === null || dataSet === void 0 ? void 0 : dataSet.length) ? cumulativeSpacingForSet[0] : cumulativeSpacing1, factor) -
|
|
766
765
|
(pointerRadius || pointerWidth / 2) -
|
|
767
766
|
1;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.4.
|
|
4
|
-
"description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar, Population Pyramid, Radar and
|
|
3
|
+
"version": "1.4.77",
|
|
4
|
+
"description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar, Population Pyramid, Radar, Bubble and SCatter charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -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.81"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/cli": "^7.24.8",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"population",
|
|
81
81
|
"pyramid",
|
|
82
82
|
"bubble",
|
|
83
|
+
"scatter",
|
|
83
84
|
"react",
|
|
84
85
|
"react native",
|
|
85
86
|
"react-native"
|