react-native-gifted-charts 1.2.18 → 1.2.19
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 +1 -1
- package/src/LineChart/index.tsx +46 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
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
|
@@ -2522,6 +2522,48 @@ export const LineChart = (props: propTypes) => {
|
|
|
2522
2522
|
}
|
|
2523
2523
|
pointerYLocal = Math.min(...arr);
|
|
2524
2524
|
|
|
2525
|
+
let left = 0,
|
|
2526
|
+
top = 0;
|
|
2527
|
+
if (autoAdjustPointerLabelPosition) {
|
|
2528
|
+
if (pointerX < pointerLabelWidth / 2) {
|
|
2529
|
+
left = 7;
|
|
2530
|
+
} else {
|
|
2531
|
+
if (
|
|
2532
|
+
!activatePointersOnLongPress &&
|
|
2533
|
+
pointerX >
|
|
2534
|
+
(props.width ||
|
|
2535
|
+
Dimensions.get('window').width - yAxisLabelWidth - 15) -
|
|
2536
|
+
pointerLabelWidth / 2
|
|
2537
|
+
) {
|
|
2538
|
+
left = -pointerLabelWidth - 4;
|
|
2539
|
+
} else if (
|
|
2540
|
+
activatePointersOnLongPress &&
|
|
2541
|
+
pointerX > totalWidth - yAxisLabelWidth - pointerLabelWidth / 2
|
|
2542
|
+
) {
|
|
2543
|
+
left = -pointerLabelWidth - 4;
|
|
2544
|
+
} else {
|
|
2545
|
+
left = -pointerLabelWidth / 2 + 5;
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
} else {
|
|
2549
|
+
left = (pointerRadius || pointerWidth / 2) - 10 + shiftPointerLabelX;
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
if (autoAdjustPointerLabelPosition) {
|
|
2553
|
+
if (pointerLabelHeight - pointerYLocal > 10) {
|
|
2554
|
+
top = 10;
|
|
2555
|
+
} else {
|
|
2556
|
+
top = -pointerLabelHeight;
|
|
2557
|
+
}
|
|
2558
|
+
} else {
|
|
2559
|
+
top =
|
|
2560
|
+
(pointerStripUptoDataPoint
|
|
2561
|
+
? pointerRadius || pointerStripHeight / 2
|
|
2562
|
+
: -pointerYLocal + 8) -
|
|
2563
|
+
pointerLabelWidth / 2 +
|
|
2564
|
+
shiftPointerLabelY;
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2525
2567
|
return (
|
|
2526
2568
|
<View
|
|
2527
2569
|
style={{
|
|
@@ -2573,30 +2615,8 @@ export const LineChart = (props: propTypes) => {
|
|
|
2573
2615
|
style={[
|
|
2574
2616
|
{
|
|
2575
2617
|
position: 'absolute',
|
|
2576
|
-
left:
|
|
2577
|
-
|
|
2578
|
-
? 7
|
|
2579
|
-
: !activatePointersOnLongPress &&
|
|
2580
|
-
pointerX >
|
|
2581
|
-
(props.width ||
|
|
2582
|
-
Dimensions.get('window').width -
|
|
2583
|
-
yAxisLabelWidth -
|
|
2584
|
-
15) -
|
|
2585
|
-
pointerLabelWidth / 2
|
|
2586
|
-
? -pointerLabelWidth - 4
|
|
2587
|
-
: pointerLabelWidth / -2 + 5
|
|
2588
|
-
: (pointerRadius || pointerWidth / 2) -
|
|
2589
|
-
10 +
|
|
2590
|
-
shiftPointerLabelX,
|
|
2591
|
-
top: autoAdjustPointerLabelPosition
|
|
2592
|
-
? pointerLabelHeight - pointerYLocal > 10
|
|
2593
|
-
? 10
|
|
2594
|
-
: -pointerLabelHeight
|
|
2595
|
-
: (pointerStripUptoDataPoint
|
|
2596
|
-
? pointerRadius || pointerStripHeight / 2
|
|
2597
|
-
: -pointerYLocal + 8) -
|
|
2598
|
-
pointerLabelWidth / 2 +
|
|
2599
|
-
shiftPointerLabelY,
|
|
2618
|
+
left: left,
|
|
2619
|
+
top: top,
|
|
2600
2620
|
marginTop: pointerStripUptoDataPoint
|
|
2601
2621
|
? 0
|
|
2602
2622
|
: containerHeight - pointerStripHeight,
|
|
@@ -2795,7 +2815,6 @@ export const LineChart = (props: propTypes) => {
|
|
|
2795
2815
|
2;
|
|
2796
2816
|
setPointerX(z);
|
|
2797
2817
|
let item, y;
|
|
2798
|
-
setPointerX(z);
|
|
2799
2818
|
item = data[factor];
|
|
2800
2819
|
y =
|
|
2801
2820
|
containerHeight -
|
|
@@ -2947,7 +2966,7 @@ export const LineChart = (props: propTypes) => {
|
|
|
2947
2966
|
setResponderActive(false);
|
|
2948
2967
|
setTimeout(() => setPointerX(0), pointerVanishDelay);
|
|
2949
2968
|
}}
|
|
2950
|
-
onResponderTerminationRequest={
|
|
2969
|
+
onResponderTerminationRequest={evt => false}
|
|
2951
2970
|
// onResponderTerminate={evt => {
|
|
2952
2971
|
// console.log('evt...terminate.......',evt);
|
|
2953
2972
|
// }}
|
|
@@ -3019,7 +3038,6 @@ export const LineChart = (props: propTypes) => {
|
|
|
3019
3038
|
2;
|
|
3020
3039
|
setPointerX(z);
|
|
3021
3040
|
let item, y;
|
|
3022
|
-
setPointerX(z);
|
|
3023
3041
|
item = data[factor];
|
|
3024
3042
|
y =
|
|
3025
3043
|
containerHeight -
|
|
@@ -3170,7 +3188,7 @@ export const LineChart = (props: propTypes) => {
|
|
|
3170
3188
|
setResponderActive(false);
|
|
3171
3189
|
setTimeout(() => setPointerX(0), pointerVanishDelay);
|
|
3172
3190
|
}}
|
|
3173
|
-
onResponderTerminationRequest={
|
|
3191
|
+
onResponderTerminationRequest={evt => false}
|
|
3174
3192
|
// onResponderTerminate={evt => {
|
|
3175
3193
|
// console.log('evt...terminate.......',evt);
|
|
3176
3194
|
// }}
|