react-native-gifted-charts 1.4.54 → 1.4.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/LineChart/index.js +17 -5
- package/dist/PieChart/index.js +3 -2
- package/dist/PieChart/main.js +11 -3
- package/dist/RadarChart/index.js +15 -13
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar, Populati
|
|
|
23
23
|
- Clickable and scrollable
|
|
24
24
|
- Three-D and gradient effects
|
|
25
25
|
- Fully customizable (see the [props](docs/docs.md))
|
|
26
|
-
- Detailed [documentation](https://gifted-
|
|
26
|
+
- Detailed [documentation](https://gifted-charts.web.app/) with examples
|
|
27
27
|
- Support for **_combined_** Bar and Line charts
|
|
28
28
|
- Tested to be pixel perfect using [react-native-screenshot-test](https://www.npmjs.com/package/react-native-screenshot-test). See [the screenshot tests here](https://abhinandan-kushwaha.github.io/TestingCharts/ss-test/test.html)
|
|
29
29
|
- Detailed and illustrated [dev docs](docs/dev/index.md) that explain the architecture and working of the library
|
package/dist/LineChart/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
35
35
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
36
|
};
|
|
37
37
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
38
|
-
import { Fragment, useCallback, useEffect, useMemo, useRef
|
|
38
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
39
39
|
import { View, Animated, Easing, Text, Dimensions, I18nManager, } from 'react-native';
|
|
40
40
|
import { screenWidth, usePrevious } from '../utils';
|
|
41
41
|
import Svg, { Path, LinearGradient, Stop, Circle, Rect, Text as CanvasText, Line, ClipPath, Use, ForeignObject, } from 'react-native-svg';
|
|
@@ -48,7 +48,7 @@ export var LineChart = function (props) {
|
|
|
48
48
|
var _a, _b, _c;
|
|
49
49
|
var scrollRef = (_a = props.scrollRef) !== null && _a !== void 0 ? _a : useRef(null);
|
|
50
50
|
var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
51
|
-
|
|
51
|
+
// const heightValue = useMemo(() => new Animated.Value(0), []);
|
|
52
52
|
var widthValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
53
53
|
var widthValue2 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
54
54
|
var widthValue3 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
@@ -772,9 +772,10 @@ export var LineChart = function (props) {
|
|
|
772
772
|
}
|
|
773
773
|
};
|
|
774
774
|
var renderLine = function (containerHeightIncludingBelowXAxis, zIndex, points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, strokeLinecap, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, hideDataPoints, paramData, propsData, dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText, spacingArray, key) {
|
|
775
|
-
return (_jsx(View, { onMoveShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onStartShouldSetResponder: function (evt) {
|
|
775
|
+
return (_jsx(View, { onPointerEnter: function () { var _a; return (_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onPointerEnter) === null || _a === void 0 ? void 0 : _a.call(pointerConfig); }, onPointerLeave: function () { var _a; return (_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onPointerLeave) === null || _a === void 0 ? void 0 : _a.call(pointerConfig); }, onTouchStart: function () { var _a; return (_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onTouchStart) === null || _a === void 0 ? void 0 : _a.call(pointerConfig); }, onTouchEnd: function () { var _a; return (_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onTouchEnd) === null || _a === void 0 ? void 0 : _a.call(pointerConfig); }, onMoveShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onStartShouldSetResponder: function (evt) {
|
|
776
776
|
return pointerConfig && activatePointersInstantlyOnTouch ? true : false;
|
|
777
777
|
}, onResponderGrant: function (evt) {
|
|
778
|
+
var _a;
|
|
778
779
|
if (!pointerConfig)
|
|
779
780
|
return;
|
|
780
781
|
setResponderStartTime(evt.timeStamp);
|
|
@@ -783,7 +784,9 @@ export var LineChart = function (props) {
|
|
|
783
784
|
}
|
|
784
785
|
var x = evt.nativeEvent.locationX;
|
|
785
786
|
activatePointers(x);
|
|
787
|
+
(_a = pointerConfig.onResponderGrant) === null || _a === void 0 ? void 0 : _a.call(pointerConfig);
|
|
786
788
|
}, onResponderMove: function (evt) {
|
|
789
|
+
var _a;
|
|
787
790
|
if (!pointerConfig)
|
|
788
791
|
return;
|
|
789
792
|
if (activatePointersOnLongPress &&
|
|
@@ -798,17 +801,20 @@ export var LineChart = function (props) {
|
|
|
798
801
|
x > (props.width || Dimensions.get('window').width))
|
|
799
802
|
return;
|
|
800
803
|
activatePointers(x);
|
|
804
|
+
(_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onResponderMove) === null || _a === void 0 ? void 0 : _a.call(pointerConfig);
|
|
801
805
|
},
|
|
802
806
|
// onResponderReject={evt => {
|
|
803
807
|
// console.log('evt...reject.......',evt);
|
|
804
808
|
// }}
|
|
805
809
|
onResponderEnd: function (evt) {
|
|
810
|
+
var _a;
|
|
806
811
|
setResponderStartTime(0);
|
|
807
812
|
if (resetPointerIndexOnRelease)
|
|
808
813
|
setPointerIndex(-1);
|
|
809
814
|
setResponderActive(false);
|
|
810
815
|
if (!persistPointer)
|
|
811
816
|
setTimeout(function () { return setPointerX(0); }, pointerVanishDelay);
|
|
817
|
+
(_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onResponderEnd) === null || _a === void 0 ? void 0 : _a.call(pointerConfig);
|
|
812
818
|
}, onResponderTerminationRequest: function (evt) { return false; },
|
|
813
819
|
// onResponderTerminate={evt => {
|
|
814
820
|
// console.log('evt...terminate.......',evt);
|
|
@@ -828,9 +834,10 @@ export var LineChart = function (props) {
|
|
|
828
834
|
], children: lineSvgComponent(points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, strokeLinecap, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key, hideDataPoints, paramData, propsData, dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText, spacingArray) }, key !== null && key !== void 0 ? key : 0));
|
|
829
835
|
};
|
|
830
836
|
var renderAnimatedLine = function (containerHeightIncludingBelowXAxis, zIndex, points, animatedWidth, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, strokeLinecap, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, hideDataPoints, paramsData, propsData, dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText, spacingArray, key) {
|
|
831
|
-
return (_jsx(Animated.View, { onMoveShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onStartShouldSetResponder: function (evt) {
|
|
837
|
+
return (_jsx(Animated.View, { onPointerEnter: function () { var _a; return (_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onPointerEnter) === null || _a === void 0 ? void 0 : _a.call(pointerConfig); }, onPointerLeave: function () { var _a; return (_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onPointerLeave) === null || _a === void 0 ? void 0 : _a.call(pointerConfig); }, onMoveShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onStartShouldSetResponder: function (evt) {
|
|
832
838
|
return pointerConfig && activatePointersInstantlyOnTouch ? true : false;
|
|
833
839
|
}, onResponderGrant: function (evt) {
|
|
840
|
+
var _a;
|
|
834
841
|
if (!pointerConfig)
|
|
835
842
|
return;
|
|
836
843
|
setResponderStartTime(evt.timeStamp);
|
|
@@ -839,7 +846,9 @@ export var LineChart = function (props) {
|
|
|
839
846
|
}
|
|
840
847
|
var x = evt.nativeEvent.locationX;
|
|
841
848
|
activatePointers(x);
|
|
849
|
+
(_a = pointerConfig.onResponderGrant) === null || _a === void 0 ? void 0 : _a.call(pointerConfig);
|
|
842
850
|
}, onResponderMove: function (evt) {
|
|
851
|
+
var _a;
|
|
843
852
|
if (!pointerConfig)
|
|
844
853
|
return;
|
|
845
854
|
if (activatePointersOnLongPress &&
|
|
@@ -854,11 +863,13 @@ export var LineChart = function (props) {
|
|
|
854
863
|
x > (props.width || Dimensions.get('window').width))
|
|
855
864
|
return;
|
|
856
865
|
activatePointers(x);
|
|
866
|
+
(_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onResponderMove) === null || _a === void 0 ? void 0 : _a.call(pointerConfig);
|
|
857
867
|
},
|
|
858
868
|
// onResponderReject={evt => {
|
|
859
869
|
// console.log('evt...reject.......',evt);
|
|
860
870
|
// }}
|
|
861
871
|
onResponderEnd: function (evt) {
|
|
872
|
+
var _a;
|
|
862
873
|
// console.log('evt...end.......',evt);
|
|
863
874
|
setResponderStartTime(0);
|
|
864
875
|
if (resetPointerIndexOnRelease)
|
|
@@ -866,6 +877,7 @@ export var LineChart = function (props) {
|
|
|
866
877
|
setResponderActive(false);
|
|
867
878
|
if (!persistPointer)
|
|
868
879
|
setTimeout(function () { return setPointerX(0); }, pointerVanishDelay);
|
|
880
|
+
(_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onResponderEnd) === null || _a === void 0 ? void 0 : _a.call(pointerConfig);
|
|
869
881
|
}, onResponderTerminationRequest: function (evt) { return false; },
|
|
870
882
|
// onResponderTerminate={evt => {
|
|
871
883
|
// console.log('evt...terminate.......',evt);
|
|
@@ -1027,5 +1039,5 @@ export var LineChart = function (props) {
|
|
|
1027
1039
|
pointerItem5,
|
|
1028
1040
|
].filter(function (item) { return !!item; }), pointerIndex) })) : null] }));
|
|
1029
1041
|
};
|
|
1030
|
-
return (_jsx(BarAndLineChartsWrapper, __assign({}, barAndLineChartsWrapperProps, { dataSet: dataSet, scrollRef: scrollRef, animatedWidth: widthValue, renderChartContent: renderChartContent, remainingScrollViewProps: remainingScrollViewProps })));
|
|
1042
|
+
return (_jsx(BarAndLineChartsWrapper, __assign({}, barAndLineChartsWrapperProps, { dataSet: dataSet, scrollRef: scrollRef, animatedWidth: widthValue, renderChartContent: renderChartContent, remainingScrollViewProps: remainingScrollViewProps, nestedScrollEnabled: props.nestedScrollEnabled })));
|
|
1031
1043
|
};
|
package/dist/PieChart/index.js
CHANGED
|
@@ -10,9 +10,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import {
|
|
13
|
+
import { View } from 'react-native';
|
|
14
14
|
import { PieChartMain } from './main';
|
|
15
15
|
import { usePieChart } from 'gifted-charts-core';
|
|
16
|
+
import { isWebApp } from '../utils';
|
|
16
17
|
export var PieChart = function (props) {
|
|
17
18
|
var _a = usePieChart(props), radius = _a.radius, extraRadius = _a.extraRadius, selectedIndex = _a.selectedIndex, setSelectedIndex = _a.setSelectedIndex, startAngle = _a.startAngle, total = _a.total, donut = _a.donut, isThreeD = _a.isThreeD, semiCircle = _a.semiCircle, inwardExtraLengthForFocused = _a.inwardExtraLengthForFocused, canvasWidth = _a.canvasWidth, canvasHeight = _a.canvasHeight, innerRadius = _a.innerRadius, innerCircleColor = _a.innerCircleColor, innerCircleBorderWidth = _a.innerCircleBorderWidth, innerCircleBorderColor = _a.innerCircleBorderColor, shiftInnerCenterX = _a.shiftInnerCenterX, shiftInnerCenterY = _a.shiftInnerCenterY, tiltAngle = _a.tiltAngle, isDataShifted = _a.isDataShifted, paddingHorizontal = _a.paddingHorizontal, paddingVertical = _a.paddingVertical;
|
|
18
19
|
var renderInnerCircle = function (innerRadius, innerCircleBorderWidth) {
|
|
@@ -77,7 +78,7 @@ export var PieChart = function (props) {
|
|
|
77
78
|
position: 'absolute',
|
|
78
79
|
top: -extraRadius,
|
|
79
80
|
left: -extraRadius,
|
|
80
|
-
zIndex:
|
|
81
|
+
zIndex: isWebApp ? -1 : 0, // was not getting displayed in web (using Expo)
|
|
81
82
|
}, children: _jsx(PieChartMain, __assign({}, props, { data: [
|
|
82
83
|
__assign({}, props.data[selectedIndex]),
|
|
83
84
|
{
|
package/dist/PieChart/main.js
CHANGED
|
@@ -16,10 +16,10 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
16
16
|
};
|
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
18
|
import React, { useState } from 'react';
|
|
19
|
-
import { TouchableWithoutFeedback, View, Text
|
|
19
|
+
import { TouchableWithoutFeedback, View, Text } from 'react-native';
|
|
20
20
|
import Svg, { Path, Circle, Text as SvgText, Defs, RadialGradient, Stop, G, Line, } from 'react-native-svg';
|
|
21
21
|
import { getPieChartMainProps, pieColors, } from 'gifted-charts-core';
|
|
22
|
-
import { rnVersion } from '../utils';
|
|
22
|
+
import { isWebApp, rnVersion } from '../utils';
|
|
23
23
|
export var PieChartMain = function (props) {
|
|
24
24
|
var _a, _b;
|
|
25
25
|
var _c = getPieChartMainProps(props), isThreeD = _c.isThreeD, isBiggerPie = _c.isBiggerPie, data = _c.data, showInnerComponent = _c.showInnerComponent, radius = _c.radius, canvasWidth = _c.canvasWidth, canvasHeight = _c.canvasHeight, shadowWidth = _c.shadowWidth, backgroundColor = _c.backgroundColor, shadowColor = _c.shadowColor, semiCircle = _c.semiCircle, pi = _c.pi, initialAngle = _c.initialAngle, shadow = _c.shadow, donut = _c.donut, strokeWidth = _c.strokeWidth, strokeColor = _c.strokeColor, innerRadius = _c.innerRadius, showTooltip = _c.showTooltip, tooltipWidth = _c.tooltipWidth, tooltipComponent = _c.tooltipComponent, tooltipVerticalShift = _c.tooltipVerticalShift, tooltipHorizontalShift = _c.tooltipHorizontalShift, tooltipTextNoOfLines = _c.tooltipTextNoOfLines, tooltipBackgroundColor = _c.tooltipBackgroundColor, tooltipBorderRadius = _c.tooltipBorderRadius, tooltipSelectedIndex = _c.tooltipSelectedIndex, getTooltipText = _c.getTooltipText, showText = _c.showText, textColor = _c.textColor, textSize = _c.textSize, tiltAngle = _c.tiltAngle, labelsPosition = _c.labelsPosition, showTextBackground = _c.showTextBackground, textBackgroundColor = _c.textBackgroundColor, showValuesAsLabels = _c.showValuesAsLabels, showGradient = _c.showGradient, gradientCenterColor = _c.gradientCenterColor, minShiftX = _c.minShiftX, minShiftY = _c.minShiftY, total = _c.total, horizAdjustment = _c.horizAdjustment, vertAdjustment = _c.vertAdjustment, cx = _c.cx, cy = _c.cy, mData = _c.mData, paddingHorizontal = _c.paddingHorizontal, paddingVertical = _c.paddingVertical, extraRadius = _c.extraRadius, showExternalLabels = _c.showExternalLabels, getExternaLabelProperties = _c.getExternaLabelProperties, coordinates = _c.coordinates, onPressed = _c.onPressed, font = _c.font, fontWeight = _c.fontWeight, fontStyle = _c.fontStyle;
|
|
@@ -29,7 +29,15 @@ export var PieChartMain = function (props) {
|
|
|
29
29
|
var _d = __read(useState(0), 2), touchX = _d[0], setTouchX = _d[1];
|
|
30
30
|
var _e = __read(useState(0), 2), touchY = _e[0], setTouchY = _e[1];
|
|
31
31
|
var onPressHandler = function (e) {
|
|
32
|
-
var
|
|
32
|
+
var x = 0, y = 0;
|
|
33
|
+
if (isWebApp) {
|
|
34
|
+
x = e.clientX;
|
|
35
|
+
y = e.clientY;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
x = e.nativeEvent.locationX;
|
|
39
|
+
y = e.nativeEvent.locationY;
|
|
40
|
+
}
|
|
33
41
|
x -= extraRadius;
|
|
34
42
|
y -= extraRadius;
|
|
35
43
|
setTouchX(x);
|
package/dist/RadarChart/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Animated, View } from 'react-native';
|
|
|
4
4
|
import Svg, { Line, Polygon, Circle, Text as SvgText, Defs, RadialGradient, Stop, } from 'react-native-svg';
|
|
5
5
|
import { useRadarChart } from 'gifted-charts-core';
|
|
6
6
|
export var RadarChart = function (props) {
|
|
7
|
-
var _a = useRadarChart(props), data = _a.data, dataSet = _a.dataSet, center = _a.center, radius = _a.radius, chartSize = _a.chartSize, polarToCartesian = _a.polarToCartesian, labels = _a.labels, labelConfigArray = _a.labelConfigArray, labelsPositionOffset = _a.labelsPositionOffset, dataLabelsConfigArray = _a.dataLabelsConfigArray, maxValue = _a.maxValue, dataLabels = _a.dataLabels, dataLabelsArray = _a.dataLabelsArray, gridSections = _a.gridSections, gridFill = _a.gridFill, fontSize = _a.fontSize, stroke = _a.stroke, textAnchor = _a.textAnchor, alignmentBaseline = _a.alignmentBaseline, fontWeight = _a.fontWeight, fontFamily = _a.fontFamily, dataLabelsPositionOffset = _a.dataLabelsPositionOffset, polygonStroke = _a.polygonStroke, polygonStrokeWidth = _a.polygonStrokeWidth, polygonStrokeDashArray = _a.polygonStrokeDashArray, polygonFill = _a.polygonFill, polygonGradientColor = _a.polygonGradientColor, polygonShowGradient = _a.polygonShowGradient, polygonOpacity = _a.polygonOpacity, polygonGradientOpacity = _a.polygonGradientOpacity, polygonIsAnimated = _a.polygonIsAnimated, polygonAnimationDuration = _a.polygonAnimationDuration, asterLinesStroke = _a.asterLinesStroke, asterLinesStrokeWidth = _a.asterLinesStrokeWidth, asterLinesStrokeDashArray = _a.asterLinesStrokeDashArray, polygonPoints = _a.polygonPoints, initialPolygonPoints = _a.initialPolygonPoints, polygonPointsArray = _a.polygonPointsArray, initialPolygonPointsArray = _a.initialPolygonPointsArray, polygonConfigArray = _a.polygonConfigArray, angleStep = _a.angleStep, circular = _a.circular, hideGrid = _a.hideGrid, hideAsterLines = _a.hideAsterLines, getGridLevelProps = _a.getGridLevelProps, animateTogether = _a.animateTogether;
|
|
7
|
+
var _a = useRadarChart(props), data = _a.data, dataSet = _a.dataSet, center = _a.center, radius = _a.radius, chartSize = _a.chartSize, polarToCartesian = _a.polarToCartesian, labels = _a.labels, labelConfigArray = _a.labelConfigArray, labelsPositionOffset = _a.labelsPositionOffset, dataLabelsConfigArray = _a.dataLabelsConfigArray, maxValue = _a.maxValue, dataLabels = _a.dataLabels, dataLabelsArray = _a.dataLabelsArray, gridSections = _a.gridSections, gridFill = _a.gridFill, fontSize = _a.fontSize, stroke = _a.stroke, textAnchor = _a.textAnchor, alignmentBaseline = _a.alignmentBaseline, fontWeight = _a.fontWeight, fontFamily = _a.fontFamily, dataLabelsPositionOffset = _a.dataLabelsPositionOffset, polygonStroke = _a.polygonStroke, polygonStrokeWidth = _a.polygonStrokeWidth, polygonStrokeDashArray = _a.polygonStrokeDashArray, polygonFill = _a.polygonFill, polygonGradientColor = _a.polygonGradientColor, polygonShowGradient = _a.polygonShowGradient, polygonOpacity = _a.polygonOpacity, polygonGradientOpacity = _a.polygonGradientOpacity, polygonIsAnimated = _a.polygonIsAnimated, polygonAnimationDuration = _a.polygonAnimationDuration, asterLinesStroke = _a.asterLinesStroke, asterLinesStrokeWidth = _a.asterLinesStrokeWidth, asterLinesStrokeDashArray = _a.asterLinesStrokeDashArray, polygonPoints = _a.polygonPoints, initialPolygonPoints = _a.initialPolygonPoints, polygonPointsArray = _a.polygonPointsArray, initialPolygonPointsArray = _a.initialPolygonPointsArray, polygonConfigArray = _a.polygonConfigArray, angleStep = _a.angleStep, circular = _a.circular, hideGrid = _a.hideGrid, hideLabels = _a.hideLabels, hideAsterLines = _a.hideAsterLines, getGridLevelProps = _a.getGridLevelProps, animateTogether = _a.animateTogether;
|
|
8
8
|
var initialPolygonPointsAr = initialPolygonPoints.split(' ');
|
|
9
9
|
var finalPolygonPointsAr = polygonPoints.split(' ');
|
|
10
10
|
var AnimatedPolygon = Animated.createAnimatedComponent(Polygon);
|
|
@@ -96,16 +96,18 @@ export var RadarChart = function (props) {
|
|
|
96
96
|
var angle = index * angleStep;
|
|
97
97
|
var _a = polarToCartesian(angle, maxValue), x = _a.x, y = _a.y;
|
|
98
98
|
return (_jsx(Line, { x1: center, y1: center, x2: x, y2: y, stroke: asterLinesStroke, strokeWidth: asterLinesStrokeWidth, strokeDasharray: asterLinesStrokeDashArray }, "axis-".concat(index)));
|
|
99
|
-
}),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
99
|
+
}), hideLabels
|
|
100
|
+
? null
|
|
101
|
+
: labels.map(function (category, index) {
|
|
102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
103
|
+
var angle = index * angleStep;
|
|
104
|
+
var _q = polarToCartesian(angle, maxValue + labelsPositionOffset), x = _q.x, y = _q.y; // Offset for label position
|
|
105
|
+
var fontSizeLocal = (_b = (_a = labelConfigArray === null || labelConfigArray === void 0 ? void 0 : labelConfigArray[index]) === null || _a === void 0 ? void 0 : _a.fontSize) !== null && _b !== void 0 ? _b : fontSize;
|
|
106
|
+
var fontWeightLocal = (_d = (_c = labelConfigArray === null || labelConfigArray === void 0 ? void 0 : labelConfigArray[index]) === null || _c === void 0 ? void 0 : _c.fontWeight) !== null && _d !== void 0 ? _d : fontWeight;
|
|
107
|
+
var fontFamilyLocal = (_f = (_e = labelConfigArray === null || labelConfigArray === void 0 ? void 0 : labelConfigArray[index]) === null || _e === void 0 ? void 0 : _e.fontFamily) !== null && _f !== void 0 ? _f : fontFamily;
|
|
108
|
+
var colorLocal = (_h = (_g = labelConfigArray === null || labelConfigArray === void 0 ? void 0 : labelConfigArray[index]) === null || _g === void 0 ? void 0 : _g.stroke) !== null && _h !== void 0 ? _h : stroke;
|
|
109
|
+
var textAnchorLocal = (_k = (_j = labelConfigArray === null || labelConfigArray === void 0 ? void 0 : labelConfigArray[index]) === null || _j === void 0 ? void 0 : _j.textAnchor) !== null && _k !== void 0 ? _k : textAnchor;
|
|
110
|
+
var alignmentBaselineLocal = (_m = (_l = labelConfigArray === null || labelConfigArray === void 0 ? void 0 : labelConfigArray[index]) === null || _l === void 0 ? void 0 : _l.alignmentBaseline) !== null && _m !== void 0 ? _m : alignmentBaseline;
|
|
111
|
+
return (_jsx(SvgText, { x: x, y: y, fontSize: fontSizeLocal, fontWeight: fontWeightLocal, fontFamily: fontFamilyLocal, fill: colorLocal, textAnchor: (_o = textAnchorLocal) !== null && _o !== void 0 ? _o : 'middle', alignmentBaseline: (_p = alignmentBaselineLocal) !== null && _p !== void 0 ? _p : 'middle', children: category }, "label-".concat(index)));
|
|
112
|
+
})] }) }));
|
|
111
113
|
};
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a, _b;
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
|
-
import { Dimensions } from 'react-native';
|
|
3
|
+
import { Dimensions, Platform } from 'react-native';
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
5
|
var versionString = require('react-native/package.json').version;
|
|
6
6
|
var versionAr = (_b = (_a = versionString === null || versionString === void 0 ? void 0 : versionString.split) === null || _a === void 0 ? void 0 : _a.call(versionString, '.')) !== null && _b !== void 0 ? _b : '';
|
|
@@ -18,3 +18,4 @@ export function usePrevious(value) {
|
|
|
18
18
|
}, [value]); //this code will run when the value of 'value' changes
|
|
19
19
|
return ref.current; //in the end, return the current ref value.
|
|
20
20
|
}
|
|
21
|
+
export var isWebApp = Platform.OS === 'web';
|
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.55",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar, Population Pyramid and Radar 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.57"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/cli": "^7.24.8",
|