react-native-gifted-charts 1.4.54 → 1.4.56
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 +2 -2
- package/dist/BarChart/RenderBars.js +9 -2
- package/dist/BarChart/RenderStackBars.js +22 -3
- package/dist/BarChart/index.js +42 -56
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +9 -3
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +4 -3
- package/dist/LineChart/index.js +17 -5
- package/dist/PieChart/index.js +3 -2
- package/dist/PieChart/main.js +19 -4
- 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
|
|
@@ -31,7 +31,7 @@ The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar, Populati
|
|
|
31
31
|
The web counterpart of this library is public now. Try out our new reactJS library- [react-gifted-charts](https://www.npmjs.com/package/react-gifted-charts) <br />
|
|
32
32
|
The exact same piece of code that you write to render charts in react-native, can be used to render charts in reactJS using this library!
|
|
33
33
|
|
|
34
|
-
## [Release notes 🎉](release-notes/release-notes.md)
|
|
34
|
+
## [Release notes (Changelog) 🎉](release-notes/release-notes.md)
|
|
35
35
|
|
|
36
36
|
See the **[release changes by version here.](release-notes/release-notes.md)**
|
|
37
37
|
|
|
@@ -17,7 +17,7 @@ import { getPropsForAnimated2DWithGradient, useRenderBars, } from 'gifted-charts
|
|
|
17
17
|
import Tooltip from '../Components/BarSpecificComponents/tooltip';
|
|
18
18
|
var RenderBars = function (props) {
|
|
19
19
|
var _a, _b;
|
|
20
|
-
var item = props.item, index = props.index, containerHeight = props.containerHeight, maxValue = props.maxValue, minHeight = props.minHeight, spacing = props.spacing, side = props.side, data = props.data, barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, isThreeD = props.isThreeD, isAnimated = props.isAnimated, rotateLabel = props.rotateLabel, appearingOpacity = props.appearingOpacity, animationDuration = props.animationDuration, autoShiftLabels = props.autoShiftLabels, label = props.label, secondaryLabel = props.secondaryLabel, labelTextStyle = props.labelTextStyle, secondaryLabelTextStyle = props.secondaryLabelTextStyle, xAxisTextNumberOfLines = props.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, renderTooltip = props.renderTooltip, selectedIndex = props.selectedIndex, setSelectedIndex = props.setSelectedIndex, horizontal = props.horizontal, rtl = props.rtl, pointerConfig = props.pointerConfig, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, barWidth = props.barWidth, _c = props.labelsDistanceFromXaxis, labelsDistanceFromXaxis = _c === void 0 ? 0 : _c, secondaryXAxis = props.secondaryXAxis, secondaryNoOfSectionsBelowXAxis = props.secondaryNoOfSectionsBelowXAxis, _d = props.barMarginBottom, barMarginBottom = _d === void 0 ? 0 : _d;
|
|
20
|
+
var item = props.item, index = props.index, containerHeight = props.containerHeight, maxValue = props.maxValue, minHeight = props.minHeight, spacing = props.spacing, side = props.side, data = props.data, barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, isThreeD = props.isThreeD, isAnimated = props.isAnimated, rotateLabel = props.rotateLabel, appearingOpacity = props.appearingOpacity, animationDuration = props.animationDuration, autoShiftLabels = props.autoShiftLabels, label = props.label, secondaryLabel = props.secondaryLabel, labelTextStyle = props.labelTextStyle, secondaryLabelTextStyle = props.secondaryLabelTextStyle, xAxisTextNumberOfLines = props.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, renderTooltip = props.renderTooltip, selectedIndex = props.selectedIndex, setSelectedIndex = props.setSelectedIndex, horizontal = props.horizontal, rtl = props.rtl, pointerConfig = props.pointerConfig, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, barWidth = props.barWidth, _c = props.labelsDistanceFromXaxis, labelsDistanceFromXaxis = _c === void 0 ? 0 : _c, secondaryXAxis = props.secondaryXAxis, secondaryNoOfSectionsBelowXAxis = props.secondaryNoOfSectionsBelowXAxis, _d = props.barMarginBottom, barMarginBottom = _d === void 0 ? 0 : _d, highlightEnabled = props.highlightEnabled, highlightedBarIndex = props.highlightedBarIndex, lowlightOpacity = props.lowlightOpacity;
|
|
21
21
|
var _e = useRenderBars(props), heightFactor = _e.heightFactor, barHeight = _e.barHeight, tooltipProps = _e.tooltipProps;
|
|
22
22
|
var _f = getPropsForAnimated2DWithGradient(__assign(__assign({}, props), { barHeight: barHeight })), commonStyleForBar = _f.commonStyleForBar, barStyleWithBackground = _f.barStyleWithBackground, commonPropsFor2dAnd3dBars = _f.commonPropsFor2dAnd3dBars, isFocused = _f.isFocused, focusedBarConfig = _f.focusedBarConfig, localFrontColor = _f.localFrontColor;
|
|
23
23
|
var itemOrPropsBarInnerComponent = (_a = item.barInnerComponent) !== null && _a !== void 0 ? _a : props.barInnerComponent;
|
|
@@ -140,6 +140,13 @@ var RenderBars = function (props) {
|
|
|
140
140
|
var barWrapperStyle = [
|
|
141
141
|
{
|
|
142
142
|
// overflow: 'visible',
|
|
143
|
+
opacity: highlightEnabled
|
|
144
|
+
? highlightedBarIndex === -1
|
|
145
|
+
? 1
|
|
146
|
+
: highlightedBarIndex === index
|
|
147
|
+
? 1
|
|
148
|
+
: lowlightOpacity
|
|
149
|
+
: 1,
|
|
143
150
|
marginBottom: 60 + barMarginBottom + xAxisLabelsVerticalShift - 0.5,
|
|
144
151
|
width: commonPropsFor2dAnd3dBars.barWidth,
|
|
145
152
|
height: barHeight,
|
|
@@ -181,7 +188,7 @@ var RenderBars = function (props) {
|
|
|
181
188
|
: null] }));
|
|
182
189
|
};
|
|
183
190
|
return (_jsxs(_Fragment, { children: [pressDisabled ? (_jsx(View, { pointerEvents: "none", style: barWrapperStyle, children: barContent() })) : (_jsx(TouchableOpacity, { activeOpacity: props.activeOpacity || 0.2, onPress: function () {
|
|
184
|
-
if (renderTooltip || props.focusBarOnPress) {
|
|
191
|
+
if (renderTooltip || props.focusBarOnPress || highlightEnabled) {
|
|
185
192
|
if (props.focusedBarIndex === undefined || !props.onPress) {
|
|
186
193
|
setSelectedIndex(index);
|
|
187
194
|
}
|
|
@@ -22,7 +22,7 @@ if (Platform.OS === 'android') {
|
|
|
22
22
|
}
|
|
23
23
|
var RenderStackBars = function (props) {
|
|
24
24
|
var _a;
|
|
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;
|
|
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
28
|
return (_jsx(View, { style: [
|
|
@@ -72,7 +72,7 @@ var RenderStackBars = function (props) {
|
|
|
72
72
|
var static2DSimple = function () {
|
|
73
73
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
74
74
|
var remainingBarMarginBottom = barMarginBottom;
|
|
75
|
-
return (_jsxs(_Fragment, { children: [_jsxs(TouchableOpacity, { disabled: disablePress, activeOpacity: activeOpacity, onPress: function () {
|
|
75
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TouchableOpacity, { disabled: disablePress || (stackHighlightEnabled && !highlightEnabled), activeOpacity: activeOpacity, onPress: function () {
|
|
76
76
|
setSelectedIndex(index);
|
|
77
77
|
if (item.onPress) {
|
|
78
78
|
item.onPress();
|
|
@@ -115,7 +115,19 @@ var RenderStackBars = function (props) {
|
|
|
115
115
|
var deductedMargin = Math.min(barHeight, marginBottom);
|
|
116
116
|
remainingBarMarginBottom = Math.max(0, remainingBarMarginBottom - deductedMargin);
|
|
117
117
|
barHeight -= deductedMargin;
|
|
118
|
-
return (_jsxs(TouchableOpacity, { onPress:
|
|
118
|
+
return (_jsxs(TouchableOpacity, { onPress: function (e) {
|
|
119
|
+
var _a;
|
|
120
|
+
if (stackHighlightEnabled) {
|
|
121
|
+
setSelectedStackIndex(index);
|
|
122
|
+
}
|
|
123
|
+
(_a = stackItem.onPress) === null || _a === void 0 ? void 0 : _a.call(stackItem, e);
|
|
124
|
+
}, activeOpacity: activeOpacity, disabled: disablePress ||
|
|
125
|
+
highlightEnabled ||
|
|
126
|
+
(!stackHighlightEnabled && !stackItem.onPress), style: __assign({ opacity: stackHighlightEnabled
|
|
127
|
+
? selectedStackIndex === index || selectedStackIndex === -1
|
|
128
|
+
? 1
|
|
129
|
+
: lowlightOpacity
|
|
130
|
+
: 1, position: 'absolute', bottom: getPosition(index, barHeight) + deductedMargin, width: '100%', height: barHeight, backgroundColor: stackItem.color || item.color || props.color || 'black', borderWidth: barBorderWidth !== null && barBorderWidth !== void 0 ? barBorderWidth : 0, borderColor: barBorderColor }, borderRadii), children: [stackItem.showGradient ||
|
|
119
131
|
item.showGradient ||
|
|
120
132
|
props.showGradient ? (_jsx(LinearGradient, { style: __assign({ position: 'absolute', width: '100%', height: '100%' }, borderRadii), start: { x: 0, y: 0 }, end: { x: 0, y: 1 }, colors: [
|
|
121
133
|
stackItem.gradientColor ||
|
|
@@ -158,6 +170,13 @@ var RenderStackBars = function (props) {
|
|
|
158
170
|
: 'auto', style: [
|
|
159
171
|
{
|
|
160
172
|
// overflow: 'visible',
|
|
173
|
+
opacity: highlightEnabled
|
|
174
|
+
? highlightedBarIndex === -1
|
|
175
|
+
? 1
|
|
176
|
+
: highlightedBarIndex === index
|
|
177
|
+
? 1
|
|
178
|
+
: lowlightOpacity
|
|
179
|
+
: 1,
|
|
161
180
|
marginBottom: 60 + xAxisLabelsVerticalShift,
|
|
162
181
|
width: item.stacks[0].barWidth || props.barWidth || 30,
|
|
163
182
|
height: totalHeight,
|
package/dist/BarChart/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
14
|
-
import { Animated, Easing, View } from 'react-native';
|
|
14
|
+
import { Animated, Easing, Pressable, View } from 'react-native';
|
|
15
15
|
import RenderBars from './RenderBars';
|
|
16
16
|
import RenderStackBars from './RenderStackBars';
|
|
17
17
|
import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
|
|
@@ -33,7 +33,7 @@ export var BarChart = function (props) {
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
|
-
var _c = useBarChart(__assign(__assign({}, props), { heightValue: heightValue, widthValue: widthValue, opacityValue: opacityValue, parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), lineConfig = _c.lineConfig, hidePointer1 = _c.hidePointer1, pointerItem = _c.pointerItem, pointerY = _c.pointerY, pointerConfig = _c.pointerConfig, pointerColor = _c.pointerColor, pointerX = _c.pointerX, pointerComponent = _c.pointerComponent, pointerHeight = _c.pointerHeight, pointerRadius = _c.pointerRadius, pointerWidth = _c.pointerWidth, autoAdjustPointerLabelPosition = _c.autoAdjustPointerLabelPosition, pointerLabelWidth = _c.pointerLabelWidth, activatePointersOnLongPress = _c.activatePointersOnLongPress, yAxisLabelWidth = _c.yAxisLabelWidth, shiftPointerLabelX = _c.shiftPointerLabelX, pointerLabelHeight = _c.pointerLabelHeight, pointerStripUptoDataPoint = _c.pointerStripUptoDataPoint, pointerStripHeight = _c.pointerStripHeight, shiftPointerLabelY = _c.shiftPointerLabelY, showPointerStrip = _c.showPointerStrip, pointerStripWidth = _c.pointerStripWidth, containerHeight = _c.containerHeight, xAxisThickness = _c.xAxisThickness, pointerStripColor = _c.pointerStripColor, pointerEvents = _c.pointerEvents, setResponderStartTime = _c.setResponderStartTime, setPointerY = _c.setPointerY, setPointerItem = _c.setPointerItem, initialSpacing = _c.initialSpacing, spacing = _c.spacing, data = _c.data, barWidth = _c.barWidth, setPointerX = _c.setPointerX, pointerIndex = _c.pointerIndex, setPointerIndex = _c.setPointerIndex, maxValue = _c.maxValue, responderStartTime = _c.responderStartTime, setResponderActive = _c.setResponderActive, activatePointersDelay = _c.activatePointersDelay, persistPointer = _c.persistPointer, pointerVanishDelay = _c.pointerVanishDelay, containerHeightIncludingBelowXAxis = _c.containerHeightIncludingBelowXAxis, extendedContainerHeight = _c.extendedContainerHeight, totalWidth = _c.totalWidth, stripBehindBars = _c.stripBehindBars, noOfSectionsBelowXAxis = _c.noOfSectionsBelowXAxis, stepHeight = _c.stepHeight, xAxisLabelsVerticalShift = _c.xAxisLabelsVerticalShift, labelsExtraHeight = _c.labelsExtraHeight, stripOverPointer = _c.stripOverPointer, pointerLabelComponent = _c.pointerLabelComponent, setSelectedIndex = _c.setSelectedIndex, isAnimated = _c.isAnimated, animationDuration = _c.animationDuration, side = _c.side, labelWidth = _c.labelWidth, isThreeD = _c.isThreeD, animatedHeight = _c.animatedHeight, appearingOpacity = _c.appearingOpacity, autoShiftLabels = _c.autoShiftLabels, getPropsCommonForBarAndStack = _c.getPropsCommonForBarAndStack, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps, autoShiftLabelsForNegativeStacks = _c.autoShiftLabelsForNegativeStacks;
|
|
36
|
+
var _c = useBarChart(__assign(__assign({}, props), { heightValue: heightValue, widthValue: widthValue, opacityValue: opacityValue, parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), lineConfig = _c.lineConfig, hidePointer1 = _c.hidePointer1, pointerItem = _c.pointerItem, pointerY = _c.pointerY, pointerConfig = _c.pointerConfig, pointerColor = _c.pointerColor, pointerX = _c.pointerX, pointerComponent = _c.pointerComponent, pointerHeight = _c.pointerHeight, pointerRadius = _c.pointerRadius, pointerWidth = _c.pointerWidth, autoAdjustPointerLabelPosition = _c.autoAdjustPointerLabelPosition, pointerLabelWidth = _c.pointerLabelWidth, activatePointersOnLongPress = _c.activatePointersOnLongPress, yAxisLabelWidth = _c.yAxisLabelWidth, shiftPointerLabelX = _c.shiftPointerLabelX, pointerLabelHeight = _c.pointerLabelHeight, pointerStripUptoDataPoint = _c.pointerStripUptoDataPoint, pointerStripHeight = _c.pointerStripHeight, shiftPointerLabelY = _c.shiftPointerLabelY, showPointerStrip = _c.showPointerStrip, pointerStripWidth = _c.pointerStripWidth, containerHeight = _c.containerHeight, xAxisThickness = _c.xAxisThickness, pointerStripColor = _c.pointerStripColor, pointerEvents = _c.pointerEvents, setResponderStartTime = _c.setResponderStartTime, setPointerY = _c.setPointerY, setPointerItem = _c.setPointerItem, initialSpacing = _c.initialSpacing, spacing = _c.spacing, data = _c.data, barWidth = _c.barWidth, setPointerX = _c.setPointerX, pointerIndex = _c.pointerIndex, setPointerIndex = _c.setPointerIndex, maxValue = _c.maxValue, responderStartTime = _c.responderStartTime, setResponderActive = _c.setResponderActive, activatePointersDelay = _c.activatePointersDelay, persistPointer = _c.persistPointer, pointerVanishDelay = _c.pointerVanishDelay, containerHeightIncludingBelowXAxis = _c.containerHeightIncludingBelowXAxis, extendedContainerHeight = _c.extendedContainerHeight, totalWidth = _c.totalWidth, stripBehindBars = _c.stripBehindBars, noOfSectionsBelowXAxis = _c.noOfSectionsBelowXAxis, stepHeight = _c.stepHeight, xAxisLabelsVerticalShift = _c.xAxisLabelsVerticalShift, labelsExtraHeight = _c.labelsExtraHeight, stripOverPointer = _c.stripOverPointer, pointerLabelComponent = _c.pointerLabelComponent, selectedIndex = _c.selectedIndex, setSelectedIndex = _c.setSelectedIndex, selectedStackIndex = _c.selectedStackIndex, setSelectedStackIndex = _c.setSelectedStackIndex, isAnimated = _c.isAnimated, animationDuration = _c.animationDuration, side = _c.side, labelWidth = _c.labelWidth, isThreeD = _c.isThreeD, animatedHeight = _c.animatedHeight, appearingOpacity = _c.appearingOpacity, autoShiftLabels = _c.autoShiftLabels, getPropsCommonForBarAndStack = _c.getPropsCommonForBarAndStack, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps, autoShiftLabelsForNegativeStacks = _c.autoShiftLabelsForNegativeStacks;
|
|
37
37
|
var stackData = barAndLineChartsWrapperProps.stackData;
|
|
38
38
|
var labelsAppear = useCallback(function () {
|
|
39
39
|
opacityValue.setValue(0);
|
|
@@ -118,11 +118,36 @@ export var BarChart = function (props) {
|
|
|
118
118
|
width: totalWidth,
|
|
119
119
|
flexDirection: 'row',
|
|
120
120
|
};
|
|
121
|
+
var activatePointer = function (x) {
|
|
122
|
+
var _a;
|
|
123
|
+
var factor = (x - initialSpacing - barWidth / 2) / (spacing + barWidth);
|
|
124
|
+
factor = Math.round(factor);
|
|
125
|
+
factor = Math.min(factor, data.length - 1);
|
|
126
|
+
factor = Math.max(factor, 0);
|
|
127
|
+
var z = initialSpacing +
|
|
128
|
+
(spacing + barWidth) * factor -
|
|
129
|
+
(pointerRadius || pointerWidth / 2) +
|
|
130
|
+
barWidth / 2;
|
|
131
|
+
setPointerX(z);
|
|
132
|
+
setPointerIndex(factor);
|
|
133
|
+
var item, y;
|
|
134
|
+
item = (stackData !== null && stackData !== void 0 ? stackData : data)[factor];
|
|
135
|
+
var stackSum = 0;
|
|
136
|
+
if ('stacks' in item) {
|
|
137
|
+
stackSum = item.stacks.reduce(function (acc, stack) { var _a; return acc + ((_a = stack.value) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
138
|
+
}
|
|
139
|
+
y =
|
|
140
|
+
containerHeight -
|
|
141
|
+
((stackSum !== null && stackSum !== void 0 ? stackSum : item.value) * containerHeight) / maxValue -
|
|
142
|
+
(pointerRadius || pointerHeight / 2) +
|
|
143
|
+
10;
|
|
144
|
+
setPointerY(y);
|
|
145
|
+
setPointerItem(item);
|
|
146
|
+
(_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onResponderGrant) === null || _a === void 0 ? void 0 : _a.call(pointerConfig);
|
|
147
|
+
};
|
|
121
148
|
var renderChartContent = function () {
|
|
122
149
|
if (pointerConfig) {
|
|
123
|
-
return (_jsxs(View, { onStartShouldSetResponder: function () { return !!pointerConfig; }, onMoveShouldSetResponder: function () { return !!pointerConfig; }, onResponderGrant: function (evt) {
|
|
124
|
-
if (!pointerConfig)
|
|
125
|
-
return;
|
|
150
|
+
return (_jsxs(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); }, onStartShouldSetResponder: function () { return !!pointerConfig; }, onMoveShouldSetResponder: function () { return !!pointerConfig; }, onResponderGrant: function (evt) {
|
|
126
151
|
setResponderStartTime(evt.timeStamp);
|
|
127
152
|
if (activatePointersOnLongPress) {
|
|
128
153
|
return;
|
|
@@ -131,33 +156,7 @@ export var BarChart = function (props) {
|
|
|
131
156
|
if (!activatePointersOnLongPress &&
|
|
132
157
|
x > (props.width || screenWidth))
|
|
133
158
|
return;
|
|
134
|
-
var factor = (x - initialSpacing - barWidth / 2) / (spacing + barWidth);
|
|
135
|
-
factor = Math.round(factor);
|
|
136
|
-
factor = Math.min(factor, data.length - 1);
|
|
137
|
-
factor = Math.max(factor, 0);
|
|
138
|
-
var z = initialSpacing +
|
|
139
|
-
(spacing + barWidth) * factor -
|
|
140
|
-
(pointerRadius || pointerWidth / 2) +
|
|
141
|
-
barWidth / 2;
|
|
142
|
-
setPointerX(z);
|
|
143
|
-
setPointerIndex(factor);
|
|
144
|
-
var item, y;
|
|
145
|
-
item = (stackData !== null && stackData !== void 0 ? stackData : data)[factor];
|
|
146
|
-
var stackSum = 0;
|
|
147
|
-
if ('stacks' in item) {
|
|
148
|
-
stackSum = item.stacks.reduce(function (acc, stack) { var _a; return acc + ((_a = stack.value) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
149
|
-
}
|
|
150
|
-
y =
|
|
151
|
-
containerHeight -
|
|
152
|
-
((stackSum !== null && stackSum !== void 0 ? stackSum : item.value) * containerHeight) / maxValue -
|
|
153
|
-
(pointerRadius || pointerHeight / 2) +
|
|
154
|
-
10;
|
|
155
|
-
setPointerY(y);
|
|
156
|
-
setPointerItem(item);
|
|
157
159
|
}, onResponderMove: function (evt) {
|
|
158
|
-
var _a;
|
|
159
|
-
if (!pointerConfig)
|
|
160
|
-
return;
|
|
161
160
|
if (activatePointersOnLongPress &&
|
|
162
161
|
evt.timeStamp - responderStartTime < activatePointersDelay) {
|
|
163
162
|
return;
|
|
@@ -169,35 +168,15 @@ export var BarChart = function (props) {
|
|
|
169
168
|
if (!activatePointersOnLongPress &&
|
|
170
169
|
x > (props.width || screenWidth))
|
|
171
170
|
return;
|
|
172
|
-
|
|
173
|
-
factor = Math.round(factor);
|
|
174
|
-
factor = Math.min(factor, (stackData !== null && stackData !== void 0 ? stackData : data).length - 1);
|
|
175
|
-
factor = Math.max(factor, 0);
|
|
176
|
-
var z = initialSpacing +
|
|
177
|
-
(spacing + barWidth) * factor -
|
|
178
|
-
(pointerRadius || pointerWidth / 2) +
|
|
179
|
-
barWidth / 2;
|
|
180
|
-
var item, y;
|
|
181
|
-
setPointerX(z);
|
|
182
|
-
setPointerIndex(factor);
|
|
183
|
-
item = (stackData !== null && stackData !== void 0 ? stackData : data)[factor];
|
|
184
|
-
var stackSum = 0;
|
|
185
|
-
if ('stacks' in item) {
|
|
186
|
-
(_a = item.stacks) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, stack) { var _a; return acc + ((_a = stack.value) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
187
|
-
}
|
|
188
|
-
y =
|
|
189
|
-
containerHeight -
|
|
190
|
-
((stackSum !== null && stackSum !== void 0 ? stackSum : item.value) * containerHeight) / maxValue -
|
|
191
|
-
(pointerRadius || pointerHeight / 2) +
|
|
192
|
-
10;
|
|
193
|
-
setPointerY(y);
|
|
194
|
-
setPointerItem(item);
|
|
171
|
+
activatePointer(x);
|
|
195
172
|
}, onResponderEnd: function (evt) {
|
|
173
|
+
var _a;
|
|
196
174
|
setResponderStartTime(0);
|
|
197
175
|
setPointerIndex(-1);
|
|
198
176
|
setResponderActive(false);
|
|
199
177
|
if (!persistPointer)
|
|
200
178
|
setTimeout(function () { return setPointerX(0); }, pointerVanishDelay);
|
|
179
|
+
(_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.onResponderEnd) === null || _a === void 0 ? void 0 : _a.call(pointerConfig);
|
|
201
180
|
}, onResponderTerminationRequest: function (evt) { return false; }, style: contentContainerStyle, children: [pointerX > 0 && stripBehindBars ? (_jsx(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: {
|
|
202
181
|
position: 'absolute',
|
|
203
182
|
height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
|
|
@@ -218,13 +197,20 @@ export var BarChart = function (props) {
|
|
|
218
197
|
] })) : null] }));
|
|
219
198
|
}
|
|
220
199
|
else {
|
|
221
|
-
return _jsx(
|
|
200
|
+
return (_jsx(Pressable, { style: contentContainerStyle, onPress: function () {
|
|
201
|
+
if (props.highlightEnabled && selectedIndex !== -1)
|
|
202
|
+
setSelectedIndex(-1);
|
|
203
|
+
if (props.stackHighlightEnabled && selectedStackIndex !== -1) {
|
|
204
|
+
setSelectedStackIndex(-1);
|
|
205
|
+
// props.setHighlightedStackIndex?.(-1)
|
|
206
|
+
}
|
|
207
|
+
}, children: renderChart() }));
|
|
222
208
|
}
|
|
223
209
|
};
|
|
224
210
|
var renderChart = function () {
|
|
225
211
|
if (stackData) {
|
|
226
212
|
return stackData.map(function (item, index) {
|
|
227
|
-
return (_jsx(RenderStackBars, __assign({ stackData: props.stackData || [], isAnimated: isAnimated, animationDuration: animationDuration, stackBorderRadius: props.stackBorderRadius, stackBorderTopLeftRadius: props.stackBorderTopLeftRadius, stackBorderTopRightRadius: props.stackBorderTopRightRadius, stackBorderBottomLeftRadius: props.stackBorderBottomLeftRadius, stackBorderBottomRightRadius: props.stackBorderBottomRightRadius, autoShiftLabelsForNegativeStacks: autoShiftLabelsForNegativeStacks }, getPropsCommonForBarAndStack(item, index)), index));
|
|
213
|
+
return (_jsx(RenderStackBars, __assign({ stackData: props.stackData || [], isAnimated: isAnimated, animationDuration: animationDuration, stackBorderRadius: props.stackBorderRadius, stackBorderTopLeftRadius: props.stackBorderTopLeftRadius, stackBorderTopRightRadius: props.stackBorderTopRightRadius, stackBorderBottomLeftRadius: props.stackBorderBottomLeftRadius, stackBorderBottomRightRadius: props.stackBorderBottomRightRadius, autoShiftLabelsForNegativeStacks: autoShiftLabelsForNegativeStacks, selectedStackIndex: selectedStackIndex, setSelectedStackIndex: setSelectedStackIndex }, getPropsCommonForBarAndStack(item, index)), index));
|
|
228
214
|
});
|
|
229
215
|
}
|
|
230
216
|
else {
|
|
@@ -6,8 +6,13 @@ import { renderDataPoints } from './renderDataPoints';
|
|
|
6
6
|
import { renderSpecificDataPoints } from './renderSpecificDataPoints';
|
|
7
7
|
var RenderLineInBarChart = function (props) {
|
|
8
8
|
var _a;
|
|
9
|
-
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;
|
|
9
|
+
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
10
|
var firstBarWidth = (_a = data[0].barWidth) !== null && _a !== void 0 ? _a : barWidth;
|
|
11
|
+
var opacity = highlightEnabled
|
|
12
|
+
? selectedIndex === -1
|
|
13
|
+
? 1
|
|
14
|
+
: lowlightOpacity
|
|
15
|
+
: 1;
|
|
11
16
|
var dataPointsProps = {
|
|
12
17
|
data: data,
|
|
13
18
|
lineConfig: lineConfig,
|
|
@@ -19,6 +24,7 @@ var RenderLineInBarChart = function (props) {
|
|
|
19
24
|
spacing: spacing,
|
|
20
25
|
selectedIndex: selectedIndex,
|
|
21
26
|
yAxisOffset: yAxisOffset,
|
|
27
|
+
opacity: opacity,
|
|
22
28
|
};
|
|
23
29
|
var specificVerticalLinesProps = {
|
|
24
30
|
data: data,
|
|
@@ -51,7 +57,7 @@ var RenderLineInBarChart = function (props) {
|
|
|
51
57
|
width: animatedWidth,
|
|
52
58
|
zIndex: lineBehindBars ? -1 : 100000,
|
|
53
59
|
// backgroundColor: 'wheat',
|
|
54
|
-
}, children: _jsxs(Svg, { children: [_jsx(Path, { d: points, fill: "none", stroke: lineConfig.color, strokeWidth: lineConfig.thickness, strokeDasharray: lineConfig.strokeDashArray }), renderSpecificVerticalLines(specificVerticalLinesProps), !lineConfig.hideDataPoints
|
|
60
|
+
}, children: _jsxs(Svg, { children: [_jsx(Path, { d: points, fill: "none", opacity: opacity, stroke: lineConfig.color, strokeWidth: lineConfig.thickness, strokeDasharray: lineConfig.strokeDashArray }), renderSpecificVerticalLines(specificVerticalLinesProps), !lineConfig.hideDataPoints
|
|
55
61
|
? renderDataPoints(dataPointsProps)
|
|
56
62
|
: renderSpecificDataPoints(specificDataPointsProps), lineConfig.showArrow && (_jsx(Path, { d: arrowPoints, fill: (_a = lineConfig.arrowConfig) === null || _a === void 0 ? void 0 : _a.fillColor, stroke: (_b = lineConfig.arrowConfig) === null || _b === void 0 ? void 0 : _b.strokeColor, strokeWidth: (_c = lineConfig.arrowConfig) === null || _c === void 0 ? void 0 : _c.strokeWidth }))] }) }));
|
|
57
63
|
};
|
|
@@ -65,7 +71,7 @@ var RenderLineInBarChart = function (props) {
|
|
|
65
71
|
width: totalWidth,
|
|
66
72
|
zIndex: lineBehindBars ? -1 : 100000,
|
|
67
73
|
// backgroundColor: 'rgba(200,150,150,0.1)'
|
|
68
|
-
}, children: _jsxs(Svg, { children: [_jsx(Path, { d: points, fill: "none", stroke: lineConfig.color, strokeWidth: lineConfig.thickness, strokeDasharray: lineConfig.strokeDashArray }), renderSpecificVerticalLines(specificVerticalLinesProps), !lineConfig.hideDataPoints
|
|
74
|
+
}, children: _jsxs(Svg, { children: [_jsx(Path, { d: points, fill: "none", opacity: opacity, stroke: lineConfig.color, strokeWidth: lineConfig.thickness, strokeDasharray: lineConfig.strokeDashArray }), renderSpecificVerticalLines(specificVerticalLinesProps), !lineConfig.hideDataPoints
|
|
69
75
|
? renderDataPoints(dataPointsProps)
|
|
70
76
|
: renderSpecificDataPoints(specificDataPointsProps), lineConfig.showArrow && (_jsx(Path, { d: arrowPoints, fill: (_a = lineConfig.arrowConfig) === null || _a === void 0 ? void 0 : _a.fillColor, stroke: (_b = lineConfig.arrowConfig) === null || _b === void 0 ? void 0 : _b.strokeColor, strokeWidth: (_c = lineConfig.arrowConfig) === null || _c === void 0 ? void 0 : _c.strokeWidth }))] }) }));
|
|
71
77
|
};
|
|
@@ -5,7 +5,7 @@ import { View } from 'react-native';
|
|
|
5
5
|
import { getXForLineInBar, getYForLineInBar } from 'gifted-charts-core';
|
|
6
6
|
import { Rect, Text as CanvasText, Circle } from 'react-native-svg';
|
|
7
7
|
export var renderDataPoints = function (props) {
|
|
8
|
-
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, selectedIndex = props.selectedIndex, yAxisOffset = props.yAxisOffset;
|
|
8
|
+
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, selectedIndex = props.selectedIndex, yAxisOffset = props.yAxisOffset, opacity = props.opacity;
|
|
9
9
|
return data.map(function (item, index) {
|
|
10
10
|
var _a, _b, _c, _d, _e;
|
|
11
11
|
if (index < lineConfig.startIndex ||
|
|
@@ -28,6 +28,7 @@ export var renderDataPoints = function (props) {
|
|
|
28
28
|
return (_jsx(View, { style: [
|
|
29
29
|
styles.customDataPointContainer,
|
|
30
30
|
{
|
|
31
|
+
opacity: opacity,
|
|
31
32
|
height: lineConfig.dataPointsHeight,
|
|
32
33
|
width: lineConfig.dataPointsWidth,
|
|
33
34
|
top: containerHeight -
|
|
@@ -39,11 +40,11 @@ export var renderDataPoints = function (props) {
|
|
|
39
40
|
}
|
|
40
41
|
if (lineConfig.dataPointsShape === 'rectangular') {
|
|
41
42
|
return (_jsxs(Fragment, { children: [_jsx(Rect, { x: getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing), y: getYForLineInBar(value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset) -
|
|
42
|
-
lineConfig.dataPointsHeight / 2, width: lineConfig.dataPointsWidth, height: lineConfig.dataPointsHeight, fill: dataPointColor }), item.dataPointText && (_jsx(CanvasText, { fill: item.textColor || lineConfig.textColor, fontSize: item.textFontSize || lineConfig.textFontSize, x: getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing) + (item.textShiftX || lineConfig.textShiftX || 0), y: getYForLineInBar(value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset) -
|
|
43
|
+
lineConfig.dataPointsHeight / 2, width: lineConfig.dataPointsWidth, height: lineConfig.dataPointsHeight, fill: dataPointColor, opacity: opacity }), item.dataPointText && (_jsx(CanvasText, { fill: item.textColor || lineConfig.textColor, opacity: opacity, fontSize: item.textFontSize || lineConfig.textFontSize, x: getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing) + (item.textShiftX || lineConfig.textShiftX || 0), y: getYForLineInBar(value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset) -
|
|
43
44
|
lineConfig.dataPointsHeight / 2 +
|
|
44
45
|
(item.textShiftY || lineConfig.textShiftY || 0), children: item.dataPointText }))] }, index));
|
|
45
46
|
}
|
|
46
|
-
return (_jsxs(Fragment, { children: [_jsx(Circle, { cx: getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing), cy: getYForLineInBar(value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset), r: dataPointRadius, fill: dataPointColor }), item.dataPointText && (_jsx(CanvasText, { fill: item.textColor || lineConfig.textColor, fontSize: item.textFontSize || lineConfig.textFontSize, x: getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing) + (item.textShiftX || lineConfig.textShiftX || 0), y: getYForLineInBar(value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset) -
|
|
47
|
+
return (_jsxs(Fragment, { children: [_jsx(Circle, { cx: getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing), cy: getYForLineInBar(value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset), r: dataPointRadius, fill: dataPointColor, opacity: opacity }), item.dataPointText && (_jsx(CanvasText, { fill: item.textColor || lineConfig.textColor, opacity: opacity, fontSize: item.textFontSize || lineConfig.textFontSize, x: getXForLineInBar(index, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing) + (item.textShiftX || lineConfig.textShiftX || 0), y: getYForLineInBar(value, lineConfig.shiftY, containerHeight, maxValue, yAxisOffset) -
|
|
47
48
|
lineConfig.dataPointsHeight / 2 +
|
|
48
49
|
(item.textShiftY || lineConfig.textShiftY || 0), children: item.dataPointText }))] }, index));
|
|
49
50
|
});
|
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 {
|
|
19
|
+
import { Pressable, 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;
|
|
@@ -28,8 +28,18 @@ export var PieChartMain = function (props) {
|
|
|
28
28
|
var wasFirstItemOnPole = false;
|
|
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
|
+
var _f = __read(useState(0), 2), top = _f[0], setTop = _f[1];
|
|
32
|
+
var _g = __read(useState(0), 2), left = _g[0], setLeft = _g[1];
|
|
31
33
|
var onPressHandler = function (e) {
|
|
32
|
-
var
|
|
34
|
+
var x = 0, y = 0;
|
|
35
|
+
if (isWebApp) {
|
|
36
|
+
x = e.clientX - left;
|
|
37
|
+
y = e.clientY - top;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
x = e.nativeEvent.locationX;
|
|
41
|
+
y = e.nativeEvent.locationY;
|
|
42
|
+
}
|
|
33
43
|
x -= extraRadius;
|
|
34
44
|
y -= extraRadius;
|
|
35
45
|
setTouchX(x);
|
|
@@ -57,7 +67,12 @@ export var PieChartMain = function (props) {
|
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
69
|
};
|
|
60
|
-
return (_jsx(
|
|
70
|
+
return (_jsx(Pressable, { onPress: onPressHandler, children: _jsxs(View, { pointerEvents: "box-only", onLayout: function (e) {
|
|
71
|
+
if (!isWebApp)
|
|
72
|
+
return;
|
|
73
|
+
setTop(e.nativeEvent.layout.top);
|
|
74
|
+
setLeft(e.nativeEvent.layout.left);
|
|
75
|
+
}, style: [
|
|
61
76
|
{
|
|
62
77
|
backgroundColor: backgroundColor,
|
|
63
78
|
height: semiCircle
|
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.56",
|
|
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.58"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/cli": "^7.24.8",
|