react-native-gifted-charts 1.3.8 → 1.3.9
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie, Donut and Stacked Bar charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"files": [
|
package/src/LineChart/index.tsx
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
getSecondaryDataWithOffsetIncluded,
|
|
34
34
|
getAllArrowProperties,
|
|
35
35
|
computeMaxAndMinItems,
|
|
36
|
+
clone,
|
|
36
37
|
} from '../utils';
|
|
37
38
|
import {
|
|
38
39
|
AxesAndRulesDefaults,
|
|
@@ -117,7 +118,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
117
118
|
return [];
|
|
118
119
|
}
|
|
119
120
|
if (props.yAxisOffset) {
|
|
120
|
-
return
|
|
121
|
+
return clone(props.data).map(item => {
|
|
121
122
|
item.value = item.value - (props.yAxisOffset ?? 0);
|
|
122
123
|
return item;
|
|
123
124
|
});
|
|
@@ -129,7 +130,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
129
130
|
return [];
|
|
130
131
|
}
|
|
131
132
|
if (props.yAxisOffset) {
|
|
132
|
-
return
|
|
133
|
+
return clone(props.data2).map(item => {
|
|
133
134
|
item.value = item.value - (props.yAxisOffset ?? 0);
|
|
134
135
|
return item;
|
|
135
136
|
});
|
|
@@ -141,7 +142,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
141
142
|
return [];
|
|
142
143
|
}
|
|
143
144
|
if (props.yAxisOffset) {
|
|
144
|
-
return
|
|
145
|
+
return clone(props.data3).map(item => {
|
|
145
146
|
item.value = item.value - (props.yAxisOffset ?? 0);
|
|
146
147
|
return item;
|
|
147
148
|
});
|
|
@@ -153,7 +154,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
153
154
|
return [];
|
|
154
155
|
}
|
|
155
156
|
if (props.yAxisOffset) {
|
|
156
|
-
return
|
|
157
|
+
return clone(props.data4).map(item => {
|
|
157
158
|
item.value = item.value - (props.yAxisOffset ?? 0);
|
|
158
159
|
return item;
|
|
159
160
|
});
|
|
@@ -165,7 +166,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
165
166
|
return [];
|
|
166
167
|
}
|
|
167
168
|
if (props.yAxisOffset) {
|
|
168
|
-
return
|
|
169
|
+
return clone(props.data5).map(item => {
|
|
169
170
|
item.value = item.value - (props.yAxisOffset ?? 0);
|
|
170
171
|
return item;
|
|
171
172
|
});
|
|
@@ -1755,6 +1756,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
1755
1756
|
style={[
|
|
1756
1757
|
styles.customDataPointContainer,
|
|
1757
1758
|
{
|
|
1759
|
+
zIndex: index === selectedIndex ? 1000 : 0,
|
|
1758
1760
|
top:
|
|
1759
1761
|
containerHeight +
|
|
1760
1762
|
(item.dataPointLabelShiftY ||
|
package/src/utils/index.tsx
CHANGED
|
@@ -588,3 +588,23 @@ export const getXForLineInBar = (
|
|
|
588
588
|
|
|
589
589
|
export const getYForLineInBar = (value, shiftY, containerHeight, maxValue) =>
|
|
590
590
|
containerHeight - shiftY - (value * containerHeight) / maxValue;
|
|
591
|
+
|
|
592
|
+
export const clone = (obj) => {
|
|
593
|
+
if (obj === null || typeof (obj) !== 'object' || 'isActiveClone' in obj)
|
|
594
|
+
return obj;
|
|
595
|
+
|
|
596
|
+
let temp;
|
|
597
|
+
if (obj instanceof Date)
|
|
598
|
+
temp = new Date(obj);
|
|
599
|
+
else
|
|
600
|
+
temp = obj.constructor();
|
|
601
|
+
|
|
602
|
+
for (let key in obj) {
|
|
603
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
604
|
+
obj['isActiveClone'] = null;
|
|
605
|
+
temp[key] = clone(obj[key]);
|
|
606
|
+
delete obj['isActiveClone'];
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
return temp;
|
|
610
|
+
}
|