react-native-gifted-charts 1.4.57 → 1.4.58
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/BarChart/RenderStackBars.js +24 -2
- package/dist/LineChart/index.js +11 -3
- package/dist/PieChart/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<a href="https://www.npmjs.com/package/react-native-gifted-charts">
|
|
8
8
|
<img src="/demos/npmIcon.png" height="auto" width="28" height="28" />
|
|
9
9
|
</a>
|
|
10
|
-
<a href="https://discord.gg/
|
|
10
|
+
<a href="https://discord.gg/FBbu9duJxs">
|
|
11
11
|
<img src="/demos/discord.png" height="auto" width="30" height="30" />
|
|
12
12
|
</a>
|
|
13
13
|
</p>
|
|
@@ -25,7 +25,29 @@ var RenderStackBars = function (props) {
|
|
|
25
25
|
var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, stackData = props.stackData, item = props.item, index = props.index, containerHeight = props.containerHeight, spacing = props.spacing, rotateLabel = props.rotateLabel, label = props.label, labelTextStyle = props.labelTextStyle, xAxisTextNumberOfLines = props.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, renderTooltip = props.renderTooltip, selectedIndex = props.selectedIndex, setSelectedIndex = props.setSelectedIndex, activeOpacity = props.activeOpacity, _b = props.animationDuration, animationDuration = _b === void 0 ? BarDefaults.animationDuration : _b, barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, stackBorderRadius = props.stackBorderRadius, stackBorderTopLeftRadius = props.stackBorderTopLeftRadius, stackBorderTopRightRadius = props.stackBorderTopRightRadius, stackBorderBottomLeftRadius = props.stackBorderBottomLeftRadius, stackBorderBottomRightRadius = props.stackBorderBottomRightRadius, showValuesAsTopLabel = props.showValuesAsTopLabel, _c = props.autoShiftLabelsForNegativeStacks, autoShiftLabelsForNegativeStacks = _c === void 0 ? true : _c, _d = props.labelsDistanceFromXaxis, labelsDistanceFromXaxis = _d === void 0 ? 0 : _d, horizontal = props.horizontal, secondaryStepHeight = props.secondaryStepHeight, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue, barMarginBottom = props.barMarginBottom, highlightEnabled = props.highlightEnabled, highlightedBarIndex = props.highlightedBarIndex, lowlightOpacity = props.lowlightOpacity, stackHighlightEnabled = props.stackHighlightEnabled, selectedStackIndex = props.selectedStackIndex, setSelectedStackIndex = props.setSelectedStackIndex;
|
|
26
26
|
var _e = useRenderStackBars(__assign(__assign({}, props), { secondaryStepHeight: secondaryStepHeight, secondaryStepValue: secondaryStepValue, secondaryNegativeStepHeight: secondaryNegativeStepHeight, secondaryNegativeStepValue: secondaryNegativeStepValue })), containsNegativeValue = _e.containsNegativeValue, noAnimation = _e.noAnimation, localBarInnerComponent = _e.localBarInnerComponent, borderRadius = _e.borderRadius, borderTopLeftRadius = _e.borderTopLeftRadius, borderTopRightRadius = _e.borderTopRightRadius, borderBottomLeftRadius = _e.borderBottomLeftRadius, borderBottomRightRadius = _e.borderBottomRightRadius, disablePress = _e.disablePress, totalHeight = _e.totalHeight, height = _e.height, setHeight = _e.setHeight, getBarHeight = _e.getBarHeight, getPosition = _e.getPosition, lowestBarPosition = _e.lowestBarPosition, getStackBorderRadii = _e.getStackBorderRadii, tooltipProps = _e.tooltipProps;
|
|
27
27
|
var renderLabel = function (label, labelTextStyle) {
|
|
28
|
-
return (_jsx(
|
|
28
|
+
return (_jsx(TouchableOpacity, { disabled: disablePress || (stackHighlightEnabled && !highlightEnabled), activeOpacity: activeOpacity, onPress: function () {
|
|
29
|
+
setSelectedIndex(index);
|
|
30
|
+
if (item.onPress) {
|
|
31
|
+
item.onPress();
|
|
32
|
+
}
|
|
33
|
+
else if (props.onPress) {
|
|
34
|
+
props.onPress(item, index);
|
|
35
|
+
}
|
|
36
|
+
}, onLongPress: function () {
|
|
37
|
+
if (item.onLongPress) {
|
|
38
|
+
item.onLongPress();
|
|
39
|
+
}
|
|
40
|
+
else if (props.onLongPress) {
|
|
41
|
+
props.onLongPress(item, index);
|
|
42
|
+
}
|
|
43
|
+
}, onPressOut: function () {
|
|
44
|
+
if (item.onPressOut) {
|
|
45
|
+
item.onPressOut();
|
|
46
|
+
}
|
|
47
|
+
else if (props.onPressOut) {
|
|
48
|
+
props.onPressOut(item, index);
|
|
49
|
+
}
|
|
50
|
+
}, style: [
|
|
29
51
|
{
|
|
30
52
|
width: (item.labelWidth ||
|
|
31
53
|
props.labelWidth ||
|
|
@@ -34,7 +56,7 @@ var RenderStackBars = function (props) {
|
|
|
34
56
|
30) +
|
|
35
57
|
spacing / 2,
|
|
36
58
|
position: 'absolute',
|
|
37
|
-
bottom: autoShiftLabelsForNegativeStacks
|
|
59
|
+
bottom: !labelsDistanceFromXaxis && autoShiftLabelsForNegativeStacks
|
|
38
60
|
? containsNegativeValue
|
|
39
61
|
? -0
|
|
40
62
|
: -6 - xAxisTextNumberOfLines * 18
|
package/dist/LineChart/index.js
CHANGED
|
@@ -301,7 +301,10 @@ export var LineChart = function (props) {
|
|
|
301
301
|
item.customDataPoint ||
|
|
302
302
|
props.customDataPoint;
|
|
303
303
|
dataPointLabelComponent =
|
|
304
|
-
item.focusedDataPointLabelComponent ||
|
|
304
|
+
item.focusedDataPointLabelComponent ||
|
|
305
|
+
item.dataPointLabelComponent ||
|
|
306
|
+
props.focusedDataPointLabelComponent ||
|
|
307
|
+
props.dataPointLabelComponent;
|
|
305
308
|
}
|
|
306
309
|
else {
|
|
307
310
|
dataPointsShape = item.dataPointShape || dataPtsShape;
|
|
@@ -313,7 +316,8 @@ export var LineChart = function (props) {
|
|
|
313
316
|
text = '';
|
|
314
317
|
}
|
|
315
318
|
customDataPoint = item.customDataPoint || props.customDataPoint;
|
|
316
|
-
dataPointLabelComponent =
|
|
319
|
+
dataPointLabelComponent =
|
|
320
|
+
item.dataPointLabelComponent || props.dataPointLabelComponent;
|
|
317
321
|
}
|
|
318
322
|
if (showValuesAsDataPointsText) {
|
|
319
323
|
text = originalDataFromProps[index].value;
|
|
@@ -658,7 +662,8 @@ export var LineChart = function (props) {
|
|
|
658
662
|
// return i-1;
|
|
659
663
|
// }
|
|
660
664
|
var activatePointers = function (x) {
|
|
661
|
-
var
|
|
665
|
+
var _a;
|
|
666
|
+
var factor = (x - initialSpacing) / ((_a = props.spacing1) !== null && _a !== void 0 ? _a : spacing); // getClosestValueFromSpacingArray(cumulativeSpacing1,x-initialSpacing)
|
|
662
667
|
factor = Math.round(factor);
|
|
663
668
|
factor = Math.min(factor, (data0 !== null && data0 !== void 0 ? data0 : data).length - 1);
|
|
664
669
|
factor = Math.max(factor, 0);
|
|
@@ -790,6 +795,9 @@ export var LineChart = function (props) {
|
|
|
790
795
|
setResponderActive(true);
|
|
791
796
|
}
|
|
792
797
|
var x = evt.nativeEvent.locationX;
|
|
798
|
+
var px = evt.nativeEvent.pageX;
|
|
799
|
+
if (yAxisLabelWidth != -1 && x == px)
|
|
800
|
+
return; // if locationX and pageX are equal, it means pointer has gone out of the chart, but this is not the case when yAxisLabelWidth is -1
|
|
793
801
|
if (!activatePointersOnLongPress &&
|
|
794
802
|
x > (props.width || Dimensions.get('window').width))
|
|
795
803
|
return;
|
package/dist/PieChart/index.js
CHANGED
|
@@ -79,7 +79,7 @@ export var PieChart = function (props) {
|
|
|
79
79
|
borderRightWidth: 0.5,
|
|
80
80
|
borderRightColor: innerCircleColor,
|
|
81
81
|
},
|
|
82
|
-
], children: _jsx(View, { style: { marginTop: semiCircle ? -0.5 * innerRadius : 0 }, children: props.centerLabelComponent ? props.centerLabelComponent() : null }) }));
|
|
82
|
+
], children: _jsx(View, { style: { marginTop: semiCircle ? -0.5 * innerRadius : 0 }, children: props.centerLabelComponent ? props.centerLabelComponent(selectedIndex) : null }) }));
|
|
83
83
|
}
|
|
84
84
|
return null;
|
|
85
85
|
};
|
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.58",
|
|
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.60"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/cli": "^7.24.8",
|