react-native-gifted-charts 1.4.44 → 1.4.45
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
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# react-native-gifted-charts
|
|
2
|
-
|
|
2
|
+
<p align="center">
|
|
3
|
+
<a href="https://gifted-charts.web.app">
|
|
4
|
+
<img src="/demos/favicon.png" height="auto" width="26" height="26" />
|
|
5
|
+
</a>
|
|
6
|
+
<a href="https://www.npmjs.com/package/react-native-gifted-charts">
|
|
7
|
+
<img src="/demos/npmIcon.png" height="auto" width="28" height="28" />
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://discord.gg/fnpcvzhe">
|
|
10
|
+
<img src="/demos/discord.png" height="auto" width="30" height="30" />
|
|
11
|
+
</a>
|
|
12
|
+
</p>
|
|
3
13
|
The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.
|
|
4
14
|
|
|
5
15
|
### Yet another chart library? Why?
|
|
@@ -39,8 +49,12 @@ See the **[release changes by version here.](release-notes/release-notes.md)**
|
|
|
39
49
|
<td><img src='/demos/pielabbelled.svg' alt='' height=280 width=270/></td>
|
|
40
50
|
</tr>
|
|
41
51
|
<tr>
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
<td><img src='/demos/pyrLarge.png' alt='' height=280 width=260/></td>
|
|
53
|
+
<td><img src='/demos/ppnLabelled.png' alt='' height=280 width=300/></td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td><img src='/demos/crossHair.gif' alt='' height=280 /></td>
|
|
57
|
+
<td><img src='/demos/pieExt.png' alt='' height=180 width=400 /></td>
|
|
44
58
|
</tr>
|
|
45
59
|
</table>
|
|
46
60
|
|
|
@@ -125,7 +139,7 @@ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the
|
|
|
125
139
|
|
|
126
140
|
Test strategy and cases are discussed here- [TESTS.md](./TESTS.md) <br />
|
|
127
141
|
Pixel perfection is assured using [react-native-screenshot-test](https://www.npmjs.com/package/react-native-screenshot-test). <br/>
|
|
128
|
-
|
|
142
|
+
300+ screenshot tests have been written. See the [Reports here](https://abhinandan-kushwaha.github.io/TestingCharts/ss-test/test.html).
|
|
129
143
|
|
|
130
144
|
Screenshot tests are written in a separate repo named [TestingCharts](https://github.com/Abhinandan-Kushwaha/TestingCharts)
|
|
131
145
|
|
|
@@ -6,8 +6,8 @@ export var Pointer = function (props) {
|
|
|
6
6
|
return null;
|
|
7
7
|
return (_jsx(View, { style: {
|
|
8
8
|
position: 'absolute',
|
|
9
|
-
left: pointerX + (pointerX.pointerShiftX || 0),
|
|
10
|
-
top: pointerYLocal -
|
|
9
|
+
left: pointerX + 1 + (pointerX.pointerShiftX || 0),
|
|
10
|
+
top: pointerYLocal - 4,
|
|
11
11
|
}, children: pointerComponent ? (pointerComponent()) : (_jsx(View, { style: {
|
|
12
12
|
height: pointerHeight || pointerRadius * 2,
|
|
13
13
|
width: pointerWidth || pointerRadius * 2,
|
|
@@ -3,42 +3,53 @@ import { View } from 'react-native';
|
|
|
3
3
|
import Svg, { Line } from 'react-native-svg';
|
|
4
4
|
import { getTopAndLeftForStripAndLabel, } from 'gifted-charts-core';
|
|
5
5
|
export var StripAndLabel = function (props) {
|
|
6
|
-
var _a;
|
|
7
|
-
var pointerX = props.pointerX, pointerLabelWidth = props.pointerLabelWidth, pointerRadius = props.pointerRadius, pointerWidth = props.pointerWidth, pointerYLocal = props.pointerYLocal, pointerStripUptoDataPoint = props.pointerStripUptoDataPoint, pointerStripHeight = props.pointerStripHeight, pointerItemLocal = props.pointerItemLocal, showPointerStrip = props.showPointerStrip, pointerStripWidth = props.pointerStripWidth, containerHeight = props.containerHeight, xAxisThickness = props.xAxisThickness, pointerStripColor = props.pointerStripColor, pointerConfig = props.pointerConfig, pointerLabelComponent = props.pointerLabelComponent, secondaryPointerItem = props.secondaryPointerItem, pointerItemsForSet = props.pointerItemsForSet, secondaryPointerItemsForSet = props.secondaryPointerItemsForSet, pointerEvents = props.pointerEvents, isBarChart = props.isBarChart, pointerIndex = props.pointerIndex, hasDataSet = props.hasDataSet, containsNegative = props.containsNegative;
|
|
8
|
-
var
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7
|
+
var pointerX = props.pointerX, pointerLabelWidth = props.pointerLabelWidth, pointerRadius = props.pointerRadius, pointerWidth = props.pointerWidth, pointerYLocal = props.pointerYLocal, pointerStripUptoDataPoint = props.pointerStripUptoDataPoint, pointerStripHeight = props.pointerStripHeight, pointerItemLocal = props.pointerItemLocal, showPointerStrip = props.showPointerStrip, pointerStripWidth = props.pointerStripWidth, containerHeight = props.containerHeight, xAxisThickness = props.xAxisThickness, pointerStripColor = props.pointerStripColor, pointerConfig = props.pointerConfig, pointerLabelComponent = props.pointerLabelComponent, secondaryPointerItem = props.secondaryPointerItem, pointerItemsForSet = props.pointerItemsForSet, secondaryPointerItemsForSet = props.secondaryPointerItemsForSet, pointerEvents = props.pointerEvents, isBarChart = props.isBarChart, pointerIndex = props.pointerIndex, hasDataSet = props.hasDataSet, containsNegative = props.containsNegative, horizontalStripConfig = props.horizontalStripConfig, screenWidth = props.screenWidth;
|
|
8
|
+
var _j = getTopAndLeftForStripAndLabel(props), top = _j.top, left = _j.left;
|
|
9
9
|
if (isNaN(top) || typeof top !== 'number')
|
|
10
10
|
return null;
|
|
11
11
|
return (_jsxs(View, { style: {
|
|
12
12
|
position: 'absolute',
|
|
13
|
-
left: pointerX + (((_a = pointerItemLocal[0]) === null || _a === void 0 ? void 0 : _a.pointerShiftX) || 0),
|
|
14
13
|
top: pointerYLocal,
|
|
15
14
|
}, children: [(isBarChart
|
|
16
15
|
? showPointerStrip && !pointerLabelComponent
|
|
17
|
-
: showPointerStrip) ? (
|
|
16
|
+
: showPointerStrip) ? (_jsxs(View, { style: {
|
|
18
17
|
position: 'absolute',
|
|
19
|
-
left:
|
|
20
|
-
top: containsNegative
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
18
|
+
left: -pointerStripWidth / 4,
|
|
19
|
+
top: containsNegative ? 0 : -pointerYLocal + 8 + xAxisThickness,
|
|
20
|
+
width: screenWidth,
|
|
21
|
+
height: containerHeight,
|
|
22
|
+
}, children: [_jsxs(Svg, { children: [_jsx(Line, { stroke: pointerStripColor, strokeWidth: pointerStripWidth, strokeDasharray: (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.strokeDashArray)
|
|
23
|
+
? pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.strokeDashArray
|
|
24
|
+
: '', x1: pointerX +
|
|
25
|
+
pointerRadius +
|
|
26
|
+
2 -
|
|
27
|
+
pointerStripWidth / 2 +
|
|
28
|
+
(((_a = pointerItemLocal[0]) === null || _a === void 0 ? void 0 : _a.pointerShiftX) || 0), y1: pointerStripUptoDataPoint
|
|
29
|
+
? pointerYLocal + pointerRadius - 4
|
|
30
|
+
: containerHeight - pointerStripHeight, x2: pointerX +
|
|
31
|
+
pointerRadius +
|
|
32
|
+
2 -
|
|
33
|
+
pointerStripWidth / 2 +
|
|
34
|
+
(((_b = pointerItemLocal[0]) === null || _b === void 0 ? void 0 : _b.pointerShiftX) || 0), y2: containerHeight }), horizontalStripConfig && (_jsx(Line, { stroke: (_c = horizontalStripConfig.color) !== null && _c !== void 0 ? _c : pointerStripColor, strokeWidth: (_d = horizontalStripConfig.thickness) !== null && _d !== void 0 ? _d : pointerStripWidth, strokeDasharray: ((_f = (_e = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.horizontalStripConfig) === null || _e === void 0 ? void 0 : _e.strokeDashArray) !== null && _f !== void 0 ? _f : pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.strokeDashArray)
|
|
35
|
+
? pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.strokeDashArray
|
|
36
|
+
: '', x1: 0, y1: pointerYLocal - 7, x2: horizontalStripConfig.horizontalStripUptoDataPoint
|
|
37
|
+
? pointerX + 2
|
|
38
|
+
: screenWidth, y2: pointerYLocal - 7 }))] }), (horizontalStripConfig === null || horizontalStripConfig === void 0 ? void 0 : horizontalStripConfig.labelComponent) ? (_jsx(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: [
|
|
39
|
+
{
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
left: 0,
|
|
42
|
+
top: pointerYLocal -
|
|
43
|
+
3 -
|
|
44
|
+
((_g = horizontalStripConfig.labelComponentHeight) !== null && _g !== void 0 ? _g : 30) / 2,
|
|
45
|
+
width: pointerLabelWidth,
|
|
46
|
+
},
|
|
47
|
+
], children: (_h = horizontalStripConfig === null || horizontalStripConfig === void 0 ? void 0 : horizontalStripConfig.labelComponent) === null || _h === void 0 ? void 0 : _h.call(horizontalStripConfig, hasDataSet ? pointerItemsForSet : pointerItemLocal, hasDataSet
|
|
48
|
+
? secondaryPointerItemsForSet
|
|
49
|
+
: [secondaryPointerItem], pointerIndex) })) : null] })) : null, pointerLabelComponent ? (_jsx(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: [
|
|
39
50
|
{
|
|
40
51
|
position: 'absolute',
|
|
41
|
-
left: left,
|
|
52
|
+
left: left + pointerX,
|
|
42
53
|
top: top,
|
|
43
54
|
marginTop: pointerStripUptoDataPoint
|
|
44
55
|
? 0
|
package/dist/LineChart/index.js
CHANGED
|
@@ -46,7 +46,7 @@ import { StripAndLabel } from '../Components/common/StripAndLabel';
|
|
|
46
46
|
import { Pointer } from '../Components/common/Pointer';
|
|
47
47
|
var AnimatedPath = Animated.createAnimatedComponent(Path);
|
|
48
48
|
export var LineChart = function (props) {
|
|
49
|
-
var _a, _b
|
|
49
|
+
var _a, _b;
|
|
50
50
|
var scrollRef = (_a = props.scrollRef) !== null && _a !== void 0 ? _a : useRef(null);
|
|
51
51
|
var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
52
52
|
var heightValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
@@ -55,7 +55,7 @@ export var LineChart = function (props) {
|
|
|
55
55
|
var widthValue3 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
56
56
|
var widthValue4 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
57
57
|
var widthValue5 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
58
|
-
var
|
|
58
|
+
var _c = useLineChart(__assign(__assign({}, props), { parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), curveType = _c.curveType, scrollX = _c.scrollX, setScrollX = _c.setScrollX, arrow1Points = _c.arrow1Points, arrow2Points = _c.arrow2Points, arrow3Points = _c.arrow3Points, arrow4Points = _c.arrow4Points, arrow5Points = _c.arrow5Points, secondaryArrowPoints = _c.secondaryArrowPoints, pointerIndex = _c.pointerIndex, setPointerIndex = _c.setPointerIndex, pointerX = _c.pointerX, setPointerX = _c.setPointerX, pointerY = _c.pointerY, setPointerY = _c.setPointerY, pointerItem = _c.pointerItem, setPointerItem = _c.setPointerItem, pointerY2 = _c.pointerY2, setPointerY2 = _c.setPointerY2, pointerItem2 = _c.pointerItem2, setPointerItem2 = _c.setPointerItem2, pointerY3 = _c.pointerY3, setPointerY3 = _c.setPointerY3, pointerItem3 = _c.pointerItem3, setPointerItem3 = _c.setPointerItem3, pointerY4 = _c.pointerY4, setPointerY4 = _c.setPointerY4, pointerItem4 = _c.pointerItem4, setPointerItem4 = _c.setPointerItem4, pointerY5 = _c.pointerY5, setPointerY5 = _c.setPointerY5, pointerYsForDataSet = _c.pointerYsForDataSet, setPointerYsForDataSet = _c.setPointerYsForDataSet, pointerItem5 = _c.pointerItem5, setPointerItem5 = _c.setPointerItem5, secondaryPointerY = _c.secondaryPointerY, setSecondaryPointerY = _c.setSecondaryPointerY, secondaryPointerItem = _c.secondaryPointerItem, setSecondaryPointerItem = _c.setSecondaryPointerItem, pointerItemsForSet = _c.pointerItemsForSet, setPointerItemsForSet = _c.setPointerItemsForSet, secondaryPointerItemsForSet = _c.secondaryPointerItemsForSet, setSecondaryPointerItemsForSet = _c.setSecondaryPointerItemsForSet, responderStartTime = _c.responderStartTime, setResponderStartTime = _c.setResponderStartTime, setResponderActive = _c.setResponderActive, points = _c.points, points2 = _c.points2, points3 = _c.points3, points4 = _c.points4, points5 = _c.points5, secondaryPoints = _c.secondaryPoints, fillPoints = _c.fillPoints, fillPoints2 = _c.fillPoints2, fillPoints3 = _c.fillPoints3, fillPoints4 = _c.fillPoints4, fillPoints5 = _c.fillPoints5, secondaryFillPoints = _c.secondaryFillPoints, pointsFromSet = _c.pointsFromSet, fillPointsFromSet = _c.fillPointsFromSet, arrowPointsFromSet = _c.arrowPointsFromSet, selectedIndex = _c.selectedIndex, setSelectedIndex = _c.setSelectedIndex, containerHeight = _c.containerHeight, data = _c.data, data2 = _c.data2, data3 = _c.data3, data4 = _c.data4, data5 = _c.data5, secondaryData = _c.secondaryData, dataSet = _c.dataSet, data0 = _c.data0, labelsExtraHeight = _c.labelsExtraHeight, animationDuration = _c.animationDuration, onDataChangeAnimationDuration = _c.onDataChangeAnimationDuration, animateTogether = _c.animateTogether, animateOnDataChange = _c.animateOnDataChange, startIndex1 = _c.startIndex1, startIndex2 = _c.startIndex2, endIndex1 = _c.endIndex1, endIndex2 = _c.endIndex2, startIndex3 = _c.startIndex3, endIndex3 = _c.endIndex3, startIndex4 = _c.startIndex4, endIndex4 = _c.endIndex4, startIndex5 = _c.startIndex5, endIndex5 = _c.endIndex5, initialSpacing = _c.initialSpacing, thickness = _c.thickness, yAxisLabelWidth = _c.yAxisLabelWidth, spacing = _c.spacing, xAxisThickness = _c.xAxisThickness, dataPointsHeight1 = _c.dataPointsHeight1, dataPointsWidth1 = _c.dataPointsWidth1, dataPointsRadius1 = _c.dataPointsRadius1, dataPointsColor1 = _c.dataPointsColor1, dataPointsShape1 = _c.dataPointsShape1, dataPointsHeight2 = _c.dataPointsHeight2, dataPointsWidth2 = _c.dataPointsWidth2, dataPointsRadius2 = _c.dataPointsRadius2, dataPointsColor2 = _c.dataPointsColor2, dataPointsShape2 = _c.dataPointsShape2, dataPointsHeight3 = _c.dataPointsHeight3, dataPointsWidth3 = _c.dataPointsWidth3, dataPointsRadius3 = _c.dataPointsRadius3, dataPointsColor3 = _c.dataPointsColor3, dataPointsShape3 = _c.dataPointsShape3, dataPointsHeight4 = _c.dataPointsHeight4, dataPointsWidth4 = _c.dataPointsWidth4, dataPointsRadius4 = _c.dataPointsRadius4, dataPointsColor4 = _c.dataPointsColor4, dataPointsShape4 = _c.dataPointsShape4, dataPointsHeight5 = _c.dataPointsHeight5, dataPointsWidth5 = _c.dataPointsWidth5, dataPointsRadius5 = _c.dataPointsRadius5, dataPointsColor5 = _c.dataPointsColor5, dataPointsShape5 = _c.dataPointsShape5, getIsNthAreaChart = _c.getIsNthAreaChart, textFontSize1 = _c.textFontSize1, textFontSize2 = _c.textFontSize2, textFontSize3 = _c.textFontSize3, textFontSize4 = _c.textFontSize4, textFontSize5 = _c.textFontSize5, textColor1 = _c.textColor1, textColor2 = _c.textColor2, textColor3 = _c.textColor3, textColor4 = _c.textColor4, textColor5 = _c.textColor5, totalWidth = _c.totalWidth, maxValue = _c.maxValue, overflowTop = _c.overflowTop, extendedContainerHeight = _c.extendedContainerHeight, getX = _c.getX, getY = _c.getY, getSecondaryY = _c.getSecondaryY, secondaryMaxValue = _c.secondaryMaxValue, showValuesAsDataPointsText = _c.showValuesAsDataPointsText, thickness1 = _c.thickness1, thickness2 = _c.thickness2, thickness3 = _c.thickness3, thickness4 = _c.thickness4, thickness5 = _c.thickness5, zIndex1 = _c.zIndex1, zIndex2 = _c.zIndex2, zIndex3 = _c.zIndex3, zIndex4 = _c.zIndex4, zIndex5 = _c.zIndex5, strokeDashArray1 = _c.strokeDashArray1, strokeDashArray2 = _c.strokeDashArray2, strokeDashArray3 = _c.strokeDashArray3, strokeDashArray4 = _c.strokeDashArray4, strokeDashArray5 = _c.strokeDashArray5, rotateLabel = _c.rotateLabel, isAnimated = _c.isAnimated, hideDataPoints1 = _c.hideDataPoints1, hideDataPoints2 = _c.hideDataPoints2, hideDataPoints3 = _c.hideDataPoints3, hideDataPoints4 = _c.hideDataPoints4, hideDataPoints5 = _c.hideDataPoints5, color1 = _c.color1, color2 = _c.color2, color3 = _c.color3, color4 = _c.color4, color5 = _c.color5, startFillColor1 = _c.startFillColor1, endFillColor1 = _c.endFillColor1, startOpacity1 = _c.startOpacity1, endOpacity1 = _c.endOpacity1, startFillColor2 = _c.startFillColor2, endFillColor2 = _c.endFillColor2, startOpacity2 = _c.startOpacity2, endOpacity2 = _c.endOpacity2, startFillColor3 = _c.startFillColor3, endFillColor3 = _c.endFillColor3, startOpacity3 = _c.startOpacity3, endOpacity3 = _c.endOpacity3, startFillColor4 = _c.startFillColor4, endFillColor4 = _c.endFillColor4, startOpacity4 = _c.startOpacity4, endOpacity4 = _c.endOpacity4, startFillColor5 = _c.startFillColor5, endFillColor5 = _c.endFillColor5, startOpacity5 = _c.startOpacity5, endOpacity5 = _c.endOpacity5, arrowStrokeWidth1 = _c.arrowStrokeWidth1, arrowStrokeColor1 = _c.arrowStrokeColor1, arrowFillColor1 = _c.arrowFillColor1, arrowStrokeWidth2 = _c.arrowStrokeWidth2, arrowStrokeColor2 = _c.arrowStrokeColor2, arrowFillColor2 = _c.arrowFillColor2, arrowStrokeWidth3 = _c.arrowStrokeWidth3, arrowStrokeColor3 = _c.arrowStrokeColor3, arrowFillColor3 = _c.arrowFillColor3, arrowStrokeWidth4 = _c.arrowStrokeWidth4, arrowStrokeColor4 = _c.arrowStrokeColor4, arrowFillColor4 = _c.arrowFillColor4, arrowStrokeWidth5 = _c.arrowStrokeWidth5, arrowStrokeColor5 = _c.arrowStrokeColor5, arrowFillColor5 = _c.arrowFillColor5, arrowStrokeWidthsFromSet = _c.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _c.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _c.arrowFillColorsFromSet, secondaryLineConfig = _c.secondaryLineConfig, gradientDirection = _c.gradientDirection, stepHeight = _c.stepHeight, noOfSectionsBelowXAxis = _c.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _c.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _c.xAxisLabelsVerticalShift, pointerConfig = _c.pointerConfig, pointerHeight = _c.pointerHeight, pointerWidth = _c.pointerWidth, pointerRadius = _c.pointerRadius, pointerColor = _c.pointerColor, pointerComponent = _c.pointerComponent, showPointerStrip = _c.showPointerStrip, pointerStripHeight = _c.pointerStripHeight, pointerStripWidth = _c.pointerStripWidth, pointerStripColor = _c.pointerStripColor, pointerStripUptoDataPoint = _c.pointerStripUptoDataPoint, pointerLabelComponent = _c.pointerLabelComponent, stripOverPointer = _c.stripOverPointer, shiftPointerLabelX = _c.shiftPointerLabelX, shiftPointerLabelY = _c.shiftPointerLabelY, pointerLabelWidth = _c.pointerLabelWidth, pointerLabelHeight = _c.pointerLabelHeight, autoAdjustPointerLabelPosition = _c.autoAdjustPointerLabelPosition, pointerVanishDelay = _c.pointerVanishDelay, activatePointersOnLongPress = _c.activatePointersOnLongPress, activatePointersDelay = _c.activatePointersDelay, persistPointer = _c.persistPointer, hidePointers = _c.hidePointers, hidePointer1 = _c.hidePointer1, hidePointer2 = _c.hidePointer2, hidePointer3 = _c.hidePointer3, hidePointer4 = _c.hidePointer4, hidePointer5 = _c.hidePointer5, cumulativeSpacing1 = _c.cumulativeSpacing1, cumulativeSpacing2 = _c.cumulativeSpacing2, cumulativeSpacing3 = _c.cumulativeSpacing3, cumulativeSpacing4 = _c.cumulativeSpacing4, cumulativeSpacing5 = _c.cumulativeSpacing5, cumulativeSpacingSecondary = _c.cumulativeSpacingSecondary, cumulativeSpacingForSet = _c.cumulativeSpacingForSet, hideSecondaryPointer = _c.hideSecondaryPointer, pointerEvents = _c.pointerEvents, focusEnabled = _c.focusEnabled, showDataPointOnFocus = _c.showDataPointOnFocus, showStripOnFocus = _c.showStripOnFocus, showTextOnFocus = _c.showTextOnFocus, showDataPointLabelOnFocus = _c.showDataPointLabelOnFocus, stripHeight = _c.stripHeight, stripWidth = _c.stripWidth, stripColor = _c.stripColor, stripOpacity = _c.stripOpacity, stripStrokeDashArray = _c.stripStrokeDashArray, unFocusOnPressOut = _c.unFocusOnPressOut, delayBeforeUnFocus = _c.delayBeforeUnFocus, _d = _c.containerHeightIncludingBelowXAxis, containerHeightIncludingBelowXAxis = _d === void 0 ? 0 : _d, lineGradient = _c.lineGradient, lineGradientDirection = _c.lineGradientDirection, lineGradientStartColor = _c.lineGradientStartColor, lineGradientEndColor = _c.lineGradientEndColor, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps, areaChart = _c.areaChart, mostNegativeValue = _c.mostNegativeValue;
|
|
59
59
|
var secondaryXAxis = props.secondaryXAxis, intersectionAreaConfig = props.intersectionAreaConfig;
|
|
60
60
|
var widthValuesFromSet = useMemo(function () { return dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return new Animated.Value(0); }); }, []);
|
|
61
61
|
var animatedPoints = new Animated.Value(0);
|
|
@@ -199,11 +199,7 @@ export var LineChart = function (props) {
|
|
|
199
199
|
]);
|
|
200
200
|
var svgWrapperViewStyle = {
|
|
201
201
|
position: 'absolute',
|
|
202
|
-
bottom:
|
|
203
|
-
xAxisLabelsVerticalShift +
|
|
204
|
-
labelsExtraHeight -
|
|
205
|
-
xAxisThickness -
|
|
206
|
-
((_c = props.overflowBottom) !== null && _c !== void 0 ? _c : dataPointsRadius1),
|
|
202
|
+
bottom: 62 + xAxisLabelsVerticalShift + labelsExtraHeight - xAxisThickness,
|
|
207
203
|
left: 0,
|
|
208
204
|
zIndex: 1,
|
|
209
205
|
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
|
|
@@ -501,7 +497,7 @@ export var LineChart = function (props) {
|
|
|
501
497
|
});
|
|
502
498
|
};
|
|
503
499
|
var renderStripAndLabel = function () {
|
|
504
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
500
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
505
501
|
var pointerItemLocal, pointerYLocal;
|
|
506
502
|
pointerItemLocal = [
|
|
507
503
|
__assign(__assign({}, pointerItem), { value: (_b = (_a = props.data) === null || _a === void 0 ? void 0 : _a[pointerIndex]) === null || _b === void 0 ? void 0 : _b.value }),
|
|
@@ -554,9 +550,11 @@ export var LineChart = function (props) {
|
|
|
554
550
|
isBarChart: false,
|
|
555
551
|
pointerIndex: pointerIndex,
|
|
556
552
|
width: totalWidth,
|
|
557
|
-
screenWidth: screenWidth
|
|
553
|
+
screenWidth: (_l = props.width) !== null && _l !== void 0 ? _l : Math.min(totalWidth, (_m = props.parentWidth) !== null && _m !== void 0 ? _m : screenWidth) -
|
|
554
|
+
yAxisLabelWidth,
|
|
558
555
|
hasDataSet: !!dataSet,
|
|
559
556
|
containsNegative: mostNegativeValue < 0,
|
|
557
|
+
horizontalStripConfig: pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.horizontalStripConfig,
|
|
560
558
|
});
|
|
561
559
|
};
|
|
562
560
|
var getLineGradientComponent = function () {
|
|
@@ -17,7 +17,7 @@ import { ClipPath, Line, Rect, Svg, Text as SvgText, Use, } from 'react-native-s
|
|
|
17
17
|
import { screenWidth } from '../utils';
|
|
18
18
|
export var PopulationPyramid = function (props) {
|
|
19
19
|
var _a, _b, _c, _d;
|
|
20
|
-
var _e = usePopulationPyramid(__assign(__assign({}, props), { screenWidth: screenWidth })), width = _e.width, verticalMarginBetweenBars = _e.verticalMarginBetweenBars, barsMapToYAxisSections = _e.barsMapToYAxisSections, data = _e.data, hideRules = _e.hideRules, yAxisColor = _e.yAxisColor, xAxisColor = _e.xAxisColor, xAxisThickness = _e.xAxisThickness, xAxisType = _e.xAxisType, xAxisNoOfSections = _e.xAxisNoOfSections, showXAxisIndices = _e.showXAxisIndices, showXAxisLabelTexts = _e.showXAxisLabelTexts, xAxisLabelShiftX = _e.xAxisLabelShiftX, xAxisLabelPrefix = _e.xAxisLabelPrefix, xAxisLabelSuffix = _e.xAxisLabelSuffix, formatXAxisLabels = _e.formatXAxisLabels, showVerticalLines = _e.showVerticalLines, showYAxisIndices = _e.showYAxisIndices, yAxisIndicesWidth = _e.yAxisIndicesWidth, yAxisIndicesHeight = _e.yAxisIndicesHeight, yAxisIndicesColor = _e.yAxisIndicesColor, yAxisLabelFontSize = _e.yAxisLabelFontSize, yAxisLabelFontStyle = _e.yAxisLabelFontStyle, yAxisLabelFontWeight = _e.yAxisLabelFontWeight, yAxisLabelFontFamily = _e.yAxisLabelFontFamily, yAxisLabelColor = _e.yAxisLabelColor, yAxisLabelTextMarginRight = _e.yAxisLabelTextMarginRight, yAxisLabelTexts = _e.yAxisLabelTexts, showValuesAsBarLabels = _e.showValuesAsBarLabels, rulesThickness = _e.rulesThickness, rulesColor = _e.rulesColor, rulesType = _e.rulesType, dashWidth = _e.dashWidth, dashGap = _e.dashGap, leftBarLabelWidth = _e.leftBarLabelWidth, leftBarLabelFontSize = _e.leftBarLabelFontSize, leftBarLabelColor = _e.leftBarLabelColor, leftBarLabelFontStyle = _e.leftBarLabelFontStyle, leftBarLabelFontWeight = _e.leftBarLabelFontWeight, leftBarLabelFontFamily = _e.leftBarLabelFontFamily, leftBarLabelPrefix = _e.leftBarLabelPrefix, leftBarLabelSuffix = _e.leftBarLabelSuffix, rightBarLabelFontSize = _e.rightBarLabelFontSize, rightBarLabelColor = _e.rightBarLabelColor, rightBarLabelFontStyle = _e.rightBarLabelFontStyle, rightBarLabelFontWeight = _e.rightBarLabelFontWeight, rightBarLabelFontFamily = _e.rightBarLabelFontFamily, rightBarLabelPrefix = _e.rightBarLabelPrefix, rightBarLabelSuffix = _e.rightBarLabelSuffix, formatBarLabels = _e.formatBarLabels, showMidAxis = _e.showMidAxis, midAxisLabelFontSize = _e.midAxisLabelFontSize, midAxisLabelColor = _e.midAxisLabelColor, midAxisLabelFontStyle = _e.midAxisLabelFontStyle, midAxisLabelFontWeight = _e.midAxisLabelFontWeight, midAxisLabelFontFamily = _e.midAxisLabelFontFamily, leftBarColor = _e.leftBarColor, rightBarColor = _e.rightBarColor, leftBarBorderColor = _e.leftBarBorderColor, rightBarBorderColor = _e.rightBarBorderColor, leftBarBorderWidth = _e.leftBarBorderWidth, rightBarBorderWidth = _e.rightBarBorderWidth, leftBarBorderRadius = _e.leftBarBorderRadius, rightBarBorderRadius = _e.rightBarBorderRadius, allCornersRounded = _e.allCornersRounded, showSurplus = _e.showSurplus, showSurplusLeft = _e.showSurplusLeft, showSurplusRight = _e.showSurplusRight, leftSurplusColor = _e.leftSurplusColor, leftSurplusBorderColor = _e.leftSurplusBorderColor, rightSurplusColor = _e.rightSurplusColor, rightSurplusBorderColor = _e.rightSurplusBorderColor, leftSurplusBorderWidth = _e.leftSurplusBorderWidth, rightSurplusBorderWidth = _e.rightSurplusBorderWidth, yAxisLabelWidth = _e.yAxisLabelWidth, noOfSections = _e.noOfSections, stepHeight = _e.stepHeight, containerHeightWithXaxisLabels = _e.containerHeightWithXaxisLabels, mid = _e.mid, barWidthFactor = _e.barWidthFactor, leftXAfterMid = _e.leftXAfterMid, rightXAfterMid = _e.rightXAfterMid, yAxisLineProps = _e.yAxisLineProps, midAxisLineCommonProps = _e.midAxisLineCommonProps, xAxisIndicesCommonProps = _e.xAxisIndicesCommonProps, verticalLinesCommonProps = _e.verticalLinesCommonProps, xAxisLabelsCommonProps = _e.xAxisLabelsCommonProps, getXLabel = _e.getXLabel;
|
|
20
|
+
var _e = usePopulationPyramid(__assign(__assign({}, props), { screenWidth: screenWidth })), width = _e.width, verticalMarginBetweenBars = _e.verticalMarginBetweenBars, barsMapToYAxisSections = _e.barsMapToYAxisSections, data = _e.data, hideRules = _e.hideRules, yAxisColor = _e.yAxisColor, xAxisColor = _e.xAxisColor, xAxisThickness = _e.xAxisThickness, xAxisType = _e.xAxisType, xAxisNoOfSections = _e.xAxisNoOfSections, showXAxisIndices = _e.showXAxisIndices, showXAxisLabelTexts = _e.showXAxisLabelTexts, xAxisLabelShiftX = _e.xAxisLabelShiftX, xAxisLabelPrefix = _e.xAxisLabelPrefix, xAxisLabelSuffix = _e.xAxisLabelSuffix, formatXAxisLabels = _e.formatXAxisLabels, showVerticalLines = _e.showVerticalLines, showYAxisIndices = _e.showYAxisIndices, yAxisIndicesWidth = _e.yAxisIndicesWidth, yAxisIndicesHeight = _e.yAxisIndicesHeight, yAxisIndicesColor = _e.yAxisIndicesColor, yAxisLabelFontSize = _e.yAxisLabelFontSize, yAxisLabelFontStyle = _e.yAxisLabelFontStyle, yAxisLabelFontWeight = _e.yAxisLabelFontWeight, yAxisLabelFontFamily = _e.yAxisLabelFontFamily, yAxisLabelColor = _e.yAxisLabelColor, yAxisLabelTextMarginRight = _e.yAxisLabelTextMarginRight, yAxisLabelTexts = _e.yAxisLabelTexts, showValuesAsBarLabels = _e.showValuesAsBarLabels, rulesThickness = _e.rulesThickness, rulesColor = _e.rulesColor, rulesType = _e.rulesType, dashWidth = _e.dashWidth, dashGap = _e.dashGap, leftBarLabelWidth = _e.leftBarLabelWidth, leftBarLabelFontSize = _e.leftBarLabelFontSize, leftBarLabelColor = _e.leftBarLabelColor, leftBarLabelFontStyle = _e.leftBarLabelFontStyle, leftBarLabelFontWeight = _e.leftBarLabelFontWeight, leftBarLabelFontFamily = _e.leftBarLabelFontFamily, leftBarLabelPrefix = _e.leftBarLabelPrefix, leftBarLabelSuffix = _e.leftBarLabelSuffix, rightBarLabelFontSize = _e.rightBarLabelFontSize, rightBarLabelColor = _e.rightBarLabelColor, rightBarLabelFontStyle = _e.rightBarLabelFontStyle, rightBarLabelFontWeight = _e.rightBarLabelFontWeight, rightBarLabelFontFamily = _e.rightBarLabelFontFamily, rightBarLabelPrefix = _e.rightBarLabelPrefix, rightBarLabelSuffix = _e.rightBarLabelSuffix, formatBarLabels = _e.formatBarLabels, showMidAxis = _e.showMidAxis, midAxisLabelFontSize = _e.midAxisLabelFontSize, midAxisLabelColor = _e.midAxisLabelColor, midAxisLabelFontStyle = _e.midAxisLabelFontStyle, midAxisLabelFontWeight = _e.midAxisLabelFontWeight, midAxisLabelFontFamily = _e.midAxisLabelFontFamily, leftBarColor = _e.leftBarColor, rightBarColor = _e.rightBarColor, leftBarBorderColor = _e.leftBarBorderColor, rightBarBorderColor = _e.rightBarBorderColor, leftBarBorderWidth = _e.leftBarBorderWidth, rightBarBorderWidth = _e.rightBarBorderWidth, leftBarBorderRadius = _e.leftBarBorderRadius, rightBarBorderRadius = _e.rightBarBorderRadius, allCornersRounded = _e.allCornersRounded, showSurplus = _e.showSurplus, showSurplusLeft = _e.showSurplusLeft, showSurplusRight = _e.showSurplusRight, leftSurplusColor = _e.leftSurplusColor, leftSurplusBorderColor = _e.leftSurplusBorderColor, rightSurplusColor = _e.rightSurplusColor, rightSurplusBorderColor = _e.rightSurplusBorderColor, leftSurplusBorderWidth = _e.leftSurplusBorderWidth, rightSurplusBorderWidth = _e.rightSurplusBorderWidth, yAxisLabelWidth = _e.yAxisLabelWidth, noOfSections = _e.noOfSections, stepHeight = _e.stepHeight, containerHeightWithXaxisLabels = _e.containerHeightWithXaxisLabels, mid = _e.mid, barWidthFactor = _e.barWidthFactor, leftXAfterMid = _e.leftXAfterMid, rightXAfterMid = _e.rightXAfterMid, yAxisLineProps = _e.yAxisLineProps, midAxisLineCommonProps = _e.midAxisLineCommonProps, xAxisIndicesCommonProps = _e.xAxisIndicesCommonProps, verticalLinesCommonProps = _e.verticalLinesCommonProps, xAxisLabelsCommonProps = _e.xAxisLabelsCommonProps, getXLabel = _e.getXLabel, midAxisLabelWidth = _e.midAxisLabelWidth;
|
|
21
21
|
return (_jsx(View, { style: { height: containerHeightWithXaxisLabels, width: width }, children: _jsxs(Svg, { fill: 'none', children: [_jsx(Line, __assign({}, yAxisLineProps)), Array.from(Array(noOfSections)).map(function (item, index) {
|
|
22
22
|
var _a;
|
|
23
23
|
var isLast = index === noOfSections - 1;
|
|
@@ -48,7 +48,9 @@ export var PopulationPyramid = function (props) {
|
|
|
48
48
|
}), Array.from(Array(xAxisNoOfSections)).map(function (item, index) {
|
|
49
49
|
if (!index && !showMidAxis)
|
|
50
50
|
return null;
|
|
51
|
-
var x =
|
|
51
|
+
var x = midAxisLabelWidth +
|
|
52
|
+
leftXAfterMid +
|
|
53
|
+
(leftXAfterMid * index) / xAxisNoOfSections;
|
|
52
54
|
var unformattedXLabel = getXLabel(index);
|
|
53
55
|
var xLabel = formatXAxisLabels
|
|
54
56
|
? formatXAxisLabels(unformattedXLabel)
|
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.45",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"registry": "https://registry.npmjs.org/"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"gifted-charts-core": "0.1.
|
|
28
|
+
"gifted-charts-core": "0.1.45"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@babel/cli": "^7.24.8",
|