react-native-gifted-charts 1.3.21 → 1.3.23
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/BarChart/Animated2DWithGradient.tsx +17 -6
- package/src/BarChart/RenderBars.tsx +62 -101
- package/src/BarChart/index.tsx +6 -1
- package/src/BarChart/types.ts +3 -0
- package/src/Components/AnimatedBar/index.tsx +35 -22
- package/src/Components/BarAndLineChartsWrapper/index.tsx +3 -1
- package/src/Components/ThreeDBar/index.tsx +18 -9
- package/src/Components/common/StripAndLabel.tsx +2 -1
- package/src/LineChart/index.tsx +146 -32
- package/src/LineChart/types.ts +2 -0
- package/src/utils/constants.ts +14 -0
- package/src/utils/index.tsx +276 -25
- package/src/utils/types.ts +11 -0
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.23",
|
|
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": [
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
LayoutAnimation,
|
|
6
6
|
Platform,
|
|
7
7
|
UIManager,
|
|
8
|
+
Text,
|
|
8
9
|
} from 'react-native';
|
|
9
10
|
import LinearGradient from 'react-native-linear-gradient';
|
|
10
11
|
import Svg, {Defs, Rect} from 'react-native-svg';
|
|
@@ -35,6 +36,9 @@ type propTypes = {
|
|
|
35
36
|
capRadius?: number;
|
|
36
37
|
horizontal: boolean;
|
|
37
38
|
intactTopLabel: boolean;
|
|
39
|
+
showValuesAsTopLabel: boolean;
|
|
40
|
+
topLabelContainerStyle?: any;
|
|
41
|
+
topLabelTextStyle?: any;
|
|
38
42
|
barBorderRadius?: number;
|
|
39
43
|
barBorderTopLeftRadius?: number;
|
|
40
44
|
barBorderTopRightRadius?: number;
|
|
@@ -67,6 +71,10 @@ const Animated2DWithGradient = (props: propTypes) => {
|
|
|
67
71
|
barBorderTopRightRadius,
|
|
68
72
|
barBorderBottomLeftRadius,
|
|
69
73
|
barBorderBottomRightRadius,
|
|
74
|
+
intactTopLabel,
|
|
75
|
+
showValuesAsTopLabel,
|
|
76
|
+
topLabelContainerStyle,
|
|
77
|
+
topLabelTextStyle,
|
|
70
78
|
} = props;
|
|
71
79
|
const [height, setHeight] = useState(noAnimation ? props.height : 0.2);
|
|
72
80
|
const [initialRender, setInitialRender] = useState(
|
|
@@ -299,7 +307,7 @@ const Animated2DWithGradient = (props: propTypes) => {
|
|
|
299
307
|
</Svg>
|
|
300
308
|
)}
|
|
301
309
|
</View>
|
|
302
|
-
{item.topLabelComponent && (
|
|
310
|
+
{(item.topLabelComponent || showValuesAsTopLabel) && (
|
|
303
311
|
<View
|
|
304
312
|
style={[
|
|
305
313
|
{
|
|
@@ -308,8 +316,7 @@ const Animated2DWithGradient = (props: propTypes) => {
|
|
|
308
316
|
height: item.barWidth || barWidth || 30,
|
|
309
317
|
width: item.barWidth || barWidth || 30,
|
|
310
318
|
justifyContent:
|
|
311
|
-
(props.horizontal && !
|
|
312
|
-
item.value < 0
|
|
319
|
+
(props.horizontal && !intactTopLabel) || item.value < 0
|
|
313
320
|
? 'center'
|
|
314
321
|
: 'flex-end',
|
|
315
322
|
alignItems: 'center',
|
|
@@ -317,10 +324,14 @@ const Animated2DWithGradient = (props: propTypes) => {
|
|
|
317
324
|
},
|
|
318
325
|
item.value < 0 && {transform: [{rotate: '180deg'}]},
|
|
319
326
|
props.horizontal &&
|
|
320
|
-
!
|
|
321
|
-
item.topLabelContainerStyle,
|
|
327
|
+
!intactTopLabel && {transform: [{rotate: '270deg'}]},
|
|
328
|
+
topLabelContainerStyle ?? item.topLabelContainerStyle,
|
|
322
329
|
]}>
|
|
323
|
-
{
|
|
330
|
+
{showValuesAsTopLabel ? (
|
|
331
|
+
<Text style={topLabelTextStyle}>{item.value}</Text>
|
|
332
|
+
) : (
|
|
333
|
+
item.topLabelComponent?.()
|
|
334
|
+
)}
|
|
324
335
|
</View>
|
|
325
336
|
)}
|
|
326
337
|
</View>
|
|
@@ -22,6 +22,7 @@ type Props = {
|
|
|
22
22
|
topColor?: ColorValue;
|
|
23
23
|
topLabelComponent?: Component;
|
|
24
24
|
topLabelContainerStyle?: any;
|
|
25
|
+
topLabelTextStyle?: any;
|
|
25
26
|
opacity?: number;
|
|
26
27
|
side?: String;
|
|
27
28
|
labelTextStyle?: any;
|
|
@@ -59,6 +60,7 @@ type Props = {
|
|
|
59
60
|
horizontal: boolean;
|
|
60
61
|
rtl: boolean;
|
|
61
62
|
intactTopLabel: boolean;
|
|
63
|
+
showValuesAsTopLabel?: boolean;
|
|
62
64
|
barBorderRadius?: number;
|
|
63
65
|
barBorderTopLeftRadius?: number;
|
|
64
66
|
barBorderTopRightRadius?: number;
|
|
@@ -121,6 +123,10 @@ const RenderBars = (props: Props) => {
|
|
|
121
123
|
xAxisThickness,
|
|
122
124
|
horizontal,
|
|
123
125
|
rtl,
|
|
126
|
+
intactTopLabel,
|
|
127
|
+
showValuesAsTopLabel,
|
|
128
|
+
topLabelContainerStyle,
|
|
129
|
+
topLabelTextStyle,
|
|
124
130
|
pointerConfig,
|
|
125
131
|
} = props;
|
|
126
132
|
|
|
@@ -315,7 +321,7 @@ const RenderBars = (props: Props) => {
|
|
|
315
321
|
patternIdFromProps={props.patternId}
|
|
316
322
|
/>
|
|
317
323
|
)}
|
|
318
|
-
{item.topLabelComponent && (
|
|
324
|
+
{(item.topLabelComponent || showValuesAsTopLabel) && (
|
|
319
325
|
<View
|
|
320
326
|
style={[
|
|
321
327
|
{
|
|
@@ -324,17 +330,21 @@ const RenderBars = (props: Props) => {
|
|
|
324
330
|
height: item.barWidth || props.barWidth || 30,
|
|
325
331
|
width: item.barWidth || props.barWidth || 30,
|
|
326
332
|
justifyContent:
|
|
327
|
-
(horizontal && !
|
|
333
|
+
(horizontal && !intactTopLabel) || item.value < 0
|
|
328
334
|
? 'center'
|
|
329
335
|
: 'flex-end',
|
|
330
336
|
alignItems: 'center',
|
|
331
337
|
},
|
|
332
338
|
item.value < 0 && {transform: [{rotate: '180deg'}]},
|
|
333
339
|
horizontal &&
|
|
334
|
-
!
|
|
335
|
-
item.topLabelContainerStyle,
|
|
340
|
+
!intactTopLabel && {transform: [{rotate: '270deg'}]},
|
|
341
|
+
topLabelContainerStyle ?? item.topLabelContainerStyle,
|
|
336
342
|
]}>
|
|
337
|
-
{
|
|
343
|
+
{showValuesAsTopLabel ? (
|
|
344
|
+
<Text style={topLabelTextStyle}>{item.value}</Text>
|
|
345
|
+
) : (
|
|
346
|
+
item.topLabelComponent?.()
|
|
347
|
+
)}
|
|
338
348
|
</View>
|
|
339
349
|
)}
|
|
340
350
|
</>
|
|
@@ -395,6 +405,42 @@ const RenderBars = (props: Props) => {
|
|
|
395
405
|
(pointerConfig && pointerConfig.barTouchable !== true);
|
|
396
406
|
|
|
397
407
|
const barContent = () => {
|
|
408
|
+
const animated2DWithGradient = (noGradient, noAnimation) => (
|
|
409
|
+
<Animated2DWithGradient
|
|
410
|
+
barBackgroundPattern={props.barBackgroundPattern}
|
|
411
|
+
patternId={props.patternId}
|
|
412
|
+
barWidth={props.barWidth || 30}
|
|
413
|
+
barStyle={barStyle}
|
|
414
|
+
item={item}
|
|
415
|
+
opacity={opacity}
|
|
416
|
+
animationDuration={animationDuration || 800}
|
|
417
|
+
roundedBottom={props.roundedBottom || false}
|
|
418
|
+
roundedTop={props.roundedTop || false}
|
|
419
|
+
noGradient={noGradient}
|
|
420
|
+
noAnimation={noAnimation}
|
|
421
|
+
gradientColor={noGradient ? undefined : props.gradientColor}
|
|
422
|
+
frontColor={props.frontColor || 'black'}
|
|
423
|
+
containerHeight={containerHeight}
|
|
424
|
+
maxValue={maxValue}
|
|
425
|
+
height={barHeight}
|
|
426
|
+
minHeight={minHeight ?? 0}
|
|
427
|
+
barMarginBottom={barMarginBottom}
|
|
428
|
+
cappedBars={props.cappedBars}
|
|
429
|
+
capThickness={props.capThickness}
|
|
430
|
+
capColor={props.capColor}
|
|
431
|
+
capRadius={props.capRadius}
|
|
432
|
+
horizontal={horizontal}
|
|
433
|
+
intactTopLabel={intactTopLabel}
|
|
434
|
+
showValuesAsTopLabel={!!showValuesAsTopLabel}
|
|
435
|
+
topLabelContainerStyle={topLabelContainerStyle}
|
|
436
|
+
topLabelTextStyle={topLabelTextStyle}
|
|
437
|
+
barBorderRadius={props.barBorderRadius || 0}
|
|
438
|
+
barBorderTopLeftRadius={barBorderTopLeftRadius}
|
|
439
|
+
barBorderTopRightRadius={barBorderTopRightRadius}
|
|
440
|
+
barBorderBottomLeftRadius={barBorderBottomLeftRadius}
|
|
441
|
+
barBorderBottomRightRadius={barBorderBottomRightRadius}
|
|
442
|
+
/>
|
|
443
|
+
);
|
|
398
444
|
return (
|
|
399
445
|
<>
|
|
400
446
|
{(props.showXAxisIndices || item.showXAxisIndex) && (
|
|
@@ -420,7 +466,6 @@ const RenderBars = (props: Props) => {
|
|
|
420
466
|
item.barBackgroundPattern || props.barBackgroundPattern
|
|
421
467
|
}
|
|
422
468
|
patternId={item.patternId || props.patternId}
|
|
423
|
-
topLabelContainerStyle={item.topLabelContainerStyle}
|
|
424
469
|
width={item.barWidth || props.barWidth || 30}
|
|
425
470
|
barStyle={barStyle}
|
|
426
471
|
item={item}
|
|
@@ -435,11 +480,13 @@ const RenderBars = (props: Props) => {
|
|
|
435
480
|
topColor={item.topColor || props.topColor || ''}
|
|
436
481
|
showGradient={item.showGradient || props.showGradient || false}
|
|
437
482
|
gradientColor={item.gradientColor || props.gradientColor}
|
|
438
|
-
topLabelComponent={item.topLabelComponent}
|
|
439
483
|
opacity={opacity || 1}
|
|
440
484
|
animationDuration={animationDuration || 800}
|
|
441
485
|
height={barHeight}
|
|
442
|
-
intactTopLabel={
|
|
486
|
+
intactTopLabel={intactTopLabel}
|
|
487
|
+
showValuesAsTopLabel={!!showValuesAsTopLabel}
|
|
488
|
+
topLabelContainerStyle={topLabelContainerStyle}
|
|
489
|
+
topLabelTextStyle={topLabelTextStyle}
|
|
443
490
|
horizontal={horizontal}
|
|
444
491
|
/>
|
|
445
492
|
) : (
|
|
@@ -450,7 +497,6 @@ const RenderBars = (props: Props) => {
|
|
|
450
497
|
patternId={item.patternId || props.patternId}
|
|
451
498
|
style={{}}
|
|
452
499
|
color={''}
|
|
453
|
-
topLabelContainerStyle={item.topLabelContainerStyle}
|
|
454
500
|
width={item.barWidth || props.barWidth || 30}
|
|
455
501
|
sideWidth={
|
|
456
502
|
item.sideWidth ||
|
|
@@ -465,111 +511,26 @@ const RenderBars = (props: Props) => {
|
|
|
465
511
|
topColor={item.topColor || props.topColor || ''}
|
|
466
512
|
showGradient={item.showGradient || props.showGradient || false}
|
|
467
513
|
gradientColor={item.gradientColor || props.gradientColor}
|
|
468
|
-
topLabelComponent={item.topLabelComponent || null}
|
|
469
514
|
opacity={opacity || 1}
|
|
470
515
|
horizontal={horizontal}
|
|
471
|
-
intactTopLabel={
|
|
516
|
+
intactTopLabel={intactTopLabel}
|
|
517
|
+
showValuesAsTopLabel={!!showValuesAsTopLabel}
|
|
518
|
+
topLabelContainerStyle={topLabelContainerStyle}
|
|
519
|
+
topLabelTextStyle={topLabelTextStyle}
|
|
472
520
|
height={barHeight}
|
|
473
521
|
value={item.value}
|
|
474
522
|
/>
|
|
475
523
|
)
|
|
476
524
|
) : item.showGradient || props.showGradient ? (
|
|
477
525
|
isAnimated ? (
|
|
478
|
-
|
|
479
|
-
barBackgroundPattern={props.barBackgroundPattern}
|
|
480
|
-
patternId={props.patternId}
|
|
481
|
-
barWidth={props.barWidth || 30}
|
|
482
|
-
barStyle={barStyle}
|
|
483
|
-
item={item}
|
|
484
|
-
opacity={opacity}
|
|
485
|
-
animationDuration={animationDuration || 800}
|
|
486
|
-
roundedBottom={props.roundedBottom || false}
|
|
487
|
-
roundedTop={props.roundedTop || false}
|
|
488
|
-
gradientColor={props.gradientColor}
|
|
489
|
-
frontColor={props.frontColor || 'black'}
|
|
490
|
-
containerHeight={containerHeight}
|
|
491
|
-
maxValue={maxValue}
|
|
492
|
-
height={barHeight}
|
|
493
|
-
minHeight={minHeight ?? 0}
|
|
494
|
-
barMarginBottom={barMarginBottom}
|
|
495
|
-
cappedBars={props.cappedBars}
|
|
496
|
-
capThickness={props.capThickness}
|
|
497
|
-
capColor={props.capColor}
|
|
498
|
-
capRadius={props.capRadius}
|
|
499
|
-
horizontal={horizontal}
|
|
500
|
-
intactTopLabel={props.intactTopLabel}
|
|
501
|
-
barBorderRadius={props.barBorderRadius || 0}
|
|
502
|
-
barBorderTopLeftRadius={barBorderTopLeftRadius}
|
|
503
|
-
barBorderTopRightRadius={barBorderTopRightRadius}
|
|
504
|
-
barBorderBottomLeftRadius={barBorderBottomLeftRadius}
|
|
505
|
-
barBorderBottomRightRadius={barBorderBottomRightRadius}
|
|
506
|
-
/>
|
|
526
|
+
animated2DWithGradient(false, false)
|
|
507
527
|
) : (
|
|
508
528
|
static2DWithGradient(item)
|
|
509
529
|
)
|
|
510
530
|
) : isAnimated ? (
|
|
511
|
-
|
|
512
|
-
barBackgroundPattern={props.barBackgroundPattern}
|
|
513
|
-
patternId={props.patternId}
|
|
514
|
-
barWidth={props.barWidth || 30}
|
|
515
|
-
barStyle={barStyle}
|
|
516
|
-
item={item}
|
|
517
|
-
opacity={opacity}
|
|
518
|
-
animationDuration={animationDuration || 800}
|
|
519
|
-
roundedBottom={props.roundedBottom || false}
|
|
520
|
-
roundedTop={props.roundedTop || false}
|
|
521
|
-
gradientColor={props.gradientColor}
|
|
522
|
-
noGradient
|
|
523
|
-
frontColor={props.frontColor || 'black'}
|
|
524
|
-
containerHeight={containerHeight}
|
|
525
|
-
maxValue={maxValue}
|
|
526
|
-
height={barHeight}
|
|
527
|
-
minHeight={minHeight || 0}
|
|
528
|
-
barMarginBottom={barMarginBottom}
|
|
529
|
-
cappedBars={props.cappedBars}
|
|
530
|
-
capThickness={props.capThickness}
|
|
531
|
-
capColor={props.capColor}
|
|
532
|
-
capRadius={props.capRadius}
|
|
533
|
-
horizontal={horizontal}
|
|
534
|
-
intactTopLabel={props.intactTopLabel}
|
|
535
|
-
barBorderRadius={props.barBorderRadius || 0}
|
|
536
|
-
barBorderTopLeftRadius={barBorderTopLeftRadius}
|
|
537
|
-
barBorderTopRightRadius={barBorderTopRightRadius}
|
|
538
|
-
barBorderBottomLeftRadius={barBorderBottomLeftRadius}
|
|
539
|
-
barBorderBottomRightRadius={barBorderBottomRightRadius}
|
|
540
|
-
/>
|
|
531
|
+
animated2DWithGradient(true, false)
|
|
541
532
|
) : (
|
|
542
|
-
|
|
543
|
-
barBackgroundPattern={props.barBackgroundPattern}
|
|
544
|
-
patternId={props.patternId}
|
|
545
|
-
barWidth={props.barWidth || 30}
|
|
546
|
-
barStyle={barStyle}
|
|
547
|
-
item={item}
|
|
548
|
-
opacity={opacity}
|
|
549
|
-
animationDuration={animationDuration || 800}
|
|
550
|
-
roundedBottom={props.roundedBottom || false}
|
|
551
|
-
roundedTop={props.roundedTop || false}
|
|
552
|
-
gradientColor={props.gradientColor}
|
|
553
|
-
noGradient
|
|
554
|
-
noAnimation
|
|
555
|
-
frontColor={props.frontColor || 'black'}
|
|
556
|
-
containerHeight={containerHeight}
|
|
557
|
-
maxValue={maxValue}
|
|
558
|
-
height={barHeight}
|
|
559
|
-
minHeight={minHeight || 0}
|
|
560
|
-
barMarginBottom={barMarginBottom}
|
|
561
|
-
cappedBars={props.cappedBars}
|
|
562
|
-
capThickness={props.capThickness}
|
|
563
|
-
capColor={props.capColor}
|
|
564
|
-
capRadius={props.capRadius}
|
|
565
|
-
horizontal={horizontal}
|
|
566
|
-
intactTopLabel={props.intactTopLabel}
|
|
567
|
-
barBorderRadius={props.barBorderRadius || 0}
|
|
568
|
-
barBorderTopLeftRadius={barBorderTopLeftRadius}
|
|
569
|
-
barBorderTopRightRadius={barBorderTopRightRadius}
|
|
570
|
-
barBorderBottomLeftRadius={barBorderBottomLeftRadius}
|
|
571
|
-
barBorderBottomRightRadius={barBorderBottomRightRadius}
|
|
572
|
-
/>
|
|
533
|
+
animated2DWithGradient(true, true)
|
|
573
534
|
)}
|
|
574
535
|
{isAnimated
|
|
575
536
|
? renderAnimatedLabel(label, labelTextStyle, item.value)
|
package/src/BarChart/index.tsx
CHANGED
|
@@ -303,6 +303,7 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
303
303
|
pointerConfig?.persistPointer ?? defaultPointerConfig.persistPointer;
|
|
304
304
|
const hidePointer1 =
|
|
305
305
|
pointerConfig?.hidePointer1 ?? defaultPointerConfig.hidePointer1;
|
|
306
|
+
const pointerEvents = pointerConfig?.pointerEvents;
|
|
306
307
|
|
|
307
308
|
const disableScroll =
|
|
308
309
|
props.disableScroll ||
|
|
@@ -612,6 +613,7 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
612
613
|
pointerConfig,
|
|
613
614
|
pointerLabelComponent,
|
|
614
615
|
scrollX: 0,
|
|
616
|
+
pointerEvents,
|
|
615
617
|
});
|
|
616
618
|
};
|
|
617
619
|
|
|
@@ -712,7 +714,7 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
712
714
|
{renderChart()}
|
|
713
715
|
{pointerX > 0 ? (
|
|
714
716
|
<View
|
|
715
|
-
pointerEvents=
|
|
717
|
+
pointerEvents={pointerEvents ?? 'none'}
|
|
716
718
|
style={{
|
|
717
719
|
position: 'absolute',
|
|
718
720
|
height:
|
|
@@ -755,6 +757,9 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
755
757
|
horizontal: horizontal,
|
|
756
758
|
rtl: rtl,
|
|
757
759
|
intactTopLabel: intactTopLabel,
|
|
760
|
+
showValuesAsTopLabel: props.showValuesAsTopLabel,
|
|
761
|
+
topLabelContainerStyle: props.topLabelContainerStyle,
|
|
762
|
+
topLabelTextStyle: props.topLabelTextStyle,
|
|
758
763
|
barBorderRadius: props.barBorderRadius,
|
|
759
764
|
barBorderTopLeftRadius: props.barBorderTopLeftRadius,
|
|
760
765
|
barBorderTopRightRadius: props.barBorderTopRightRadius,
|
package/src/BarChart/types.ts
CHANGED
|
@@ -126,6 +126,9 @@ export type BarChartPropsType = {
|
|
|
126
126
|
yAxisAtTop?: boolean;
|
|
127
127
|
|
|
128
128
|
intactTopLabel?: boolean;
|
|
129
|
+
showValuesAsTopLabel?: boolean;
|
|
130
|
+
topLabelContainerStyle?: any;
|
|
131
|
+
topLabelTextStyle?: any;
|
|
129
132
|
|
|
130
133
|
horizSections?: Array<sectionType>;
|
|
131
134
|
barBorderRadius?: number;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
LayoutAnimation,
|
|
7
7
|
Platform,
|
|
8
8
|
UIManager,
|
|
9
|
+
Text,
|
|
9
10
|
} from 'react-native';
|
|
10
11
|
import LinearGradient from 'react-native-linear-gradient';
|
|
11
12
|
import Svg, {Defs, Rect} from 'react-native-svg';
|
|
@@ -32,12 +33,13 @@ type animatedBarPropTypes = {
|
|
|
32
33
|
frontColor: ColorValue;
|
|
33
34
|
sideColor: ColorValue;
|
|
34
35
|
topColor: ColorValue;
|
|
35
|
-
topLabelComponent: any;
|
|
36
|
-
topLabelContainerStyle: any;
|
|
37
36
|
opacity: number;
|
|
38
37
|
side: String;
|
|
39
38
|
horizontal: boolean;
|
|
40
39
|
intactTopLabel: boolean;
|
|
40
|
+
showValuesAsTopLabel: boolean;
|
|
41
|
+
topLabelContainerStyle?: any;
|
|
42
|
+
topLabelTextStyle?: any;
|
|
41
43
|
barBackgroundPattern?: Function;
|
|
42
44
|
patternId?: String;
|
|
43
45
|
barStyle?: object;
|
|
@@ -107,9 +109,18 @@ const AnimatedBar = (props: animatedBarPropTypes) => {
|
|
|
107
109
|
setTimeout(() => elevate(), Platform.OS == 'ios' ? 10 : 100);
|
|
108
110
|
};
|
|
109
111
|
|
|
110
|
-
const {
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
const {
|
|
113
|
+
item,
|
|
114
|
+
width,
|
|
115
|
+
sideWidth,
|
|
116
|
+
barStyle,
|
|
117
|
+
barBackgroundPattern,
|
|
118
|
+
patternId,
|
|
119
|
+
intactTopLabel,
|
|
120
|
+
showValuesAsTopLabel,
|
|
121
|
+
topLabelContainerStyle,
|
|
122
|
+
topLabelTextStyle,
|
|
123
|
+
} = props;
|
|
113
124
|
|
|
114
125
|
const showGradient = props.showGradient || false;
|
|
115
126
|
const gradientColor = props.gradientColor || 'white';
|
|
@@ -118,9 +129,6 @@ const AnimatedBar = (props: animatedBarPropTypes) => {
|
|
|
118
129
|
const sideColor = props.sideColor || '#cc2233';
|
|
119
130
|
const topColor = props.topColor || '#ff4433';
|
|
120
131
|
|
|
121
|
-
const topLabelComponent = props.topLabelComponent || null;
|
|
122
|
-
const topLabelContainerStyle = props.topLabelContainerStyle || {};
|
|
123
|
-
|
|
124
132
|
const opacity = props.opacity || 1;
|
|
125
133
|
|
|
126
134
|
return (
|
|
@@ -194,16 +202,17 @@ const AnimatedBar = (props: animatedBarPropTypes) => {
|
|
|
194
202
|
) : null}
|
|
195
203
|
|
|
196
204
|
<View
|
|
197
|
-
style={[
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
style={[
|
|
206
|
+
{
|
|
207
|
+
width: width,
|
|
208
|
+
height: height, //animatedHeight
|
|
209
|
+
backgroundColor: frontColor,
|
|
210
|
+
borderLeftWidth: StyleSheet.hairlineWidth,
|
|
211
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
212
|
+
borderColor: 'white',
|
|
213
|
+
opacity: opacity,
|
|
214
|
+
},
|
|
215
|
+
item.barStyle || barStyle,
|
|
207
216
|
]}>
|
|
208
217
|
{showGradient && (
|
|
209
218
|
<LinearGradient
|
|
@@ -230,7 +239,7 @@ const AnimatedBar = (props: animatedBarPropTypes) => {
|
|
|
230
239
|
|
|
231
240
|
{/******************* Top Label *****************/}
|
|
232
241
|
|
|
233
|
-
{topLabelComponent && (
|
|
242
|
+
{(item.topLabelComponent || showValuesAsTopLabel) && (
|
|
234
243
|
<View
|
|
235
244
|
style={[
|
|
236
245
|
{
|
|
@@ -243,11 +252,15 @@ const AnimatedBar = (props: animatedBarPropTypes) => {
|
|
|
243
252
|
opacity: opacity,
|
|
244
253
|
},
|
|
245
254
|
props.horizontal &&
|
|
246
|
-
!
|
|
255
|
+
!intactTopLabel && {transform: [{rotate: '270deg'}]},
|
|
247
256
|
props.side === 'right' && {transform: [{rotateY: '180deg'}]},
|
|
248
|
-
topLabelContainerStyle,
|
|
257
|
+
topLabelContainerStyle ?? item.topLabelContainerStyle,
|
|
249
258
|
]}>
|
|
250
|
-
{
|
|
259
|
+
{showValuesAsTopLabel ? (
|
|
260
|
+
<Text style={topLabelTextStyle}>{item.value}</Text>
|
|
261
|
+
) : (
|
|
262
|
+
item.topLabelComponent?.()
|
|
263
|
+
)}
|
|
251
264
|
</View>
|
|
252
265
|
)}
|
|
253
266
|
|
|
@@ -103,6 +103,8 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
103
103
|
const xAxisLabelsVerticalShift =
|
|
104
104
|
axesAndRulesProps.xAxisLabelsVerticalShift ??
|
|
105
105
|
AxesAndRulesDefaults.xAxisLabelsVerticalShift;
|
|
106
|
+
const xAxisLabelsHeight = axesAndRulesProps.xAxisLabelsHeight;
|
|
107
|
+
const xAxisTextNumberOfLines = axesAndRulesProps.xAxisTextNumberOfLines;
|
|
106
108
|
const dashWidth =
|
|
107
109
|
axesAndRulesProps.dashWidth ?? AxesAndRulesDefaults.dashWidth;
|
|
108
110
|
const dashGap = axesAndRulesProps.dashGap ?? AxesAndRulesDefaults.dashGap;
|
|
@@ -334,7 +336,7 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
334
336
|
stepHeight / 2 +
|
|
335
337
|
xAxisLabelsVerticalShift +
|
|
336
338
|
50,
|
|
337
|
-
marginBottom:
|
|
339
|
+
marginBottom: (xAxisLabelsHeight ?? xAxisTextNumberOfLines * 18) - 50, //This is to not let the Things that should be rendered below the chart overlap with it
|
|
338
340
|
};
|
|
339
341
|
|
|
340
342
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {View, StyleSheet, ColorValue} from 'react-native';
|
|
2
|
+
import {View, StyleSheet, ColorValue, Text} from 'react-native';
|
|
3
3
|
import LinearGradient from 'react-native-linear-gradient';
|
|
4
4
|
import Svg, {Defs, Rect} from 'react-native-svg';
|
|
5
5
|
import {styles} from './styles';
|
|
@@ -15,12 +15,13 @@ type PropTypes = {
|
|
|
15
15
|
frontColor: ColorValue;
|
|
16
16
|
sideColor: ColorValue;
|
|
17
17
|
topColor: ColorValue;
|
|
18
|
-
topLabelComponent: any;
|
|
19
|
-
topLabelContainerStyle: any;
|
|
20
18
|
opacity: number;
|
|
21
19
|
side: String;
|
|
22
20
|
horizontal: boolean;
|
|
23
21
|
intactTopLabel: boolean;
|
|
22
|
+
showValuesAsTopLabel: boolean;
|
|
23
|
+
topLabelContainerStyle?: any;
|
|
24
|
+
topLabelTextStyle?: any;
|
|
24
25
|
value: number;
|
|
25
26
|
barBackgroundPattern?: Function;
|
|
26
27
|
patternId?: String;
|
|
@@ -80,8 +81,12 @@ const ThreeDBar = (props: PropTypes) => {
|
|
|
80
81
|
const sideColor = props.sideColor || '#cc2233';
|
|
81
82
|
const topColor = props.topColor || '#ff4433';
|
|
82
83
|
|
|
83
|
-
const
|
|
84
|
-
|
|
84
|
+
const {
|
|
85
|
+
intactTopLabel,
|
|
86
|
+
showValuesAsTopLabel,
|
|
87
|
+
topLabelContainerStyle,
|
|
88
|
+
topLabelTextStyle,
|
|
89
|
+
} = props;
|
|
85
90
|
|
|
86
91
|
const opacity = props.opacity || 1;
|
|
87
92
|
return (
|
|
@@ -184,7 +189,7 @@ const ThreeDBar = (props: PropTypes) => {
|
|
|
184
189
|
|
|
185
190
|
{/******************* Top Label *****************/}
|
|
186
191
|
|
|
187
|
-
{topLabelComponent && (
|
|
192
|
+
{(item.topLabelComponent || showValuesAsTopLabel) && (
|
|
188
193
|
<View
|
|
189
194
|
style={[
|
|
190
195
|
{
|
|
@@ -197,13 +202,17 @@ const ThreeDBar = (props: PropTypes) => {
|
|
|
197
202
|
},
|
|
198
203
|
value < 0 && {transform: [{rotate: '180deg'}]},
|
|
199
204
|
props.horizontal &&
|
|
200
|
-
!
|
|
205
|
+
!intactTopLabel && {transform: [{rotate: '270deg'}]},
|
|
201
206
|
props.side === 'right'
|
|
202
207
|
? {right: (-1 * width) / 4}
|
|
203
208
|
: {left: (-1 * width) / 4},
|
|
204
|
-
topLabelContainerStyle,
|
|
209
|
+
topLabelContainerStyle ?? item.topLabelContainerStyle,
|
|
205
210
|
]}>
|
|
206
|
-
{
|
|
211
|
+
{showValuesAsTopLabel ? (
|
|
212
|
+
<Text style={topLabelTextStyle}>{item.value}</Text>
|
|
213
|
+
) : (
|
|
214
|
+
item.topLabelComponent?.()
|
|
215
|
+
)}
|
|
207
216
|
</View>
|
|
208
217
|
)}
|
|
209
218
|
|
|
@@ -27,6 +27,7 @@ export const StripAndLabel = props => {
|
|
|
27
27
|
pointerLabelComponent,
|
|
28
28
|
secondaryPointerItem,
|
|
29
29
|
scrollX,
|
|
30
|
+
pointerEvents,
|
|
30
31
|
} = props;
|
|
31
32
|
let left = 0,
|
|
32
33
|
top = 0;
|
|
@@ -125,7 +126,7 @@ export const StripAndLabel = props => {
|
|
|
125
126
|
|
|
126
127
|
{pointerLabelComponent && (
|
|
127
128
|
<View
|
|
128
|
-
pointerEvents=
|
|
129
|
+
pointerEvents={pointerEvents ?? 'none'}
|
|
129
130
|
style={[
|
|
130
131
|
{
|
|
131
132
|
position: 'absolute',
|
package/src/LineChart/index.tsx
CHANGED
|
@@ -38,10 +38,17 @@ import {
|
|
|
38
38
|
getCurvePathWithSegments,
|
|
39
39
|
getSegmentedPathObjects,
|
|
40
40
|
getSegmentString,
|
|
41
|
+
getRegionPathObjects,
|
|
42
|
+
getPathWithHighlight,
|
|
41
43
|
} from '../utils';
|
|
42
44
|
import {
|
|
43
45
|
AxesAndRulesDefaults,
|
|
44
46
|
LineDefaults,
|
|
47
|
+
RANGE_ENTER,
|
|
48
|
+
RANGE_EXIT,
|
|
49
|
+
SEGMENT_END,
|
|
50
|
+
SEGMENT_START,
|
|
51
|
+
STOP,
|
|
45
52
|
chartTypes,
|
|
46
53
|
defaultArrowConfig,
|
|
47
54
|
defaultPointerConfig,
|
|
@@ -258,17 +265,14 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
258
265
|
const startIndex5 = props.startIndex5 || 0;
|
|
259
266
|
const endIndex5 = props.endIndex5 ?? data5.length - 1;
|
|
260
267
|
|
|
261
|
-
const startIndicesFromSet = dataSet?.map(set => set.startIndex ?? 0);
|
|
262
|
-
const endIndicesFromSet = dataSet?.map(
|
|
263
|
-
set => set.endIndex ?? set.data.length - 1,
|
|
264
|
-
);
|
|
265
|
-
|
|
266
268
|
const lineSegments = props.lineSegments;
|
|
267
269
|
const lineSegments2 = props.lineSegments2;
|
|
268
270
|
const lineSegments3 = props.lineSegments3;
|
|
269
271
|
const lineSegments4 = props.lineSegments4;
|
|
270
272
|
const lineSegments5 = props.lineSegments5;
|
|
271
273
|
|
|
274
|
+
const highlightedRange = props.highlightedRange;
|
|
275
|
+
|
|
272
276
|
if (!initialData) {
|
|
273
277
|
initialData = data0 ?? [...data];
|
|
274
278
|
animations = initialData.map(item => new Animated.Value(item.value));
|
|
@@ -885,13 +889,29 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
885
889
|
getNextPoint(data, i, around)
|
|
886
890
|
);
|
|
887
891
|
};
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
892
|
+
|
|
893
|
+
const getSegmentPath = (data, i, lineSegment, startIndex, endIndex) => {
|
|
894
|
+
let path =
|
|
895
|
+
'L' +
|
|
896
|
+
getX(i) +
|
|
897
|
+
' ' +
|
|
898
|
+
getY(data[i].value) +
|
|
899
|
+
' ' +
|
|
900
|
+
getSegmentString(lineSegment, i, SEGMENT_START, SEGMENT_END);
|
|
901
|
+
|
|
902
|
+
if (highlightedRange) {
|
|
903
|
+
path += getPathWithHighlight(
|
|
904
|
+
data,
|
|
905
|
+
i,
|
|
906
|
+
highlightedRange,
|
|
907
|
+
startIndex,
|
|
908
|
+
endIndex,
|
|
909
|
+
getX,
|
|
910
|
+
getY,
|
|
911
|
+
);
|
|
912
|
+
}
|
|
913
|
+
return path;
|
|
914
|
+
};
|
|
895
915
|
|
|
896
916
|
useEffect(() => {
|
|
897
917
|
if (dataSet) {
|
|
@@ -907,8 +927,8 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
907
927
|
const pArray: Array<Array<number>> = [];
|
|
908
928
|
for (let i = 0; i < setData.length; i++) {
|
|
909
929
|
if (
|
|
910
|
-
i >= (
|
|
911
|
-
i <= (
|
|
930
|
+
i >= (set.startIndex ?? 0) &&
|
|
931
|
+
i <= (set.endIndex ?? set.data.length - 1)
|
|
912
932
|
) {
|
|
913
933
|
pArray.push([getX(i), getY(setData[i].value)]);
|
|
914
934
|
}
|
|
@@ -918,7 +938,14 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
918
938
|
set.curveType ?? curveType,
|
|
919
939
|
set.curvature ?? curvature,
|
|
920
940
|
);
|
|
921
|
-
pointsArray.push(
|
|
941
|
+
pointsArray.push(
|
|
942
|
+
getCurvePathWithSegments(
|
|
943
|
+
xx,
|
|
944
|
+
set.lineSegments,
|
|
945
|
+
SEGMENT_START,
|
|
946
|
+
SEGMENT_END,
|
|
947
|
+
),
|
|
948
|
+
);
|
|
922
949
|
|
|
923
950
|
// For Arrow-
|
|
924
951
|
if (setData.length > 1 && (set.showArrow ?? props.showArrows)) {
|
|
@@ -953,13 +980,19 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
953
980
|
let pp = '';
|
|
954
981
|
for (let i = 0; i < setData.length; i++) {
|
|
955
982
|
if (
|
|
956
|
-
i >= (
|
|
957
|
-
i <= (
|
|
983
|
+
i >= (set.startIndex ?? 0) &&
|
|
984
|
+
i <= (set.endIndex ?? set.data.length - 1)
|
|
958
985
|
) {
|
|
959
986
|
if (set.stepChart || stepChart) {
|
|
960
987
|
pp += getStepPath(setData, i);
|
|
961
988
|
} else {
|
|
962
|
-
pp += getSegmentPath(
|
|
989
|
+
pp += getSegmentPath(
|
|
990
|
+
setData,
|
|
991
|
+
i,
|
|
992
|
+
set.lineSegments,
|
|
993
|
+
set.startIndex ?? 0,
|
|
994
|
+
set.endIndex ?? set.data.length - 1,
|
|
995
|
+
);
|
|
963
996
|
}
|
|
964
997
|
}
|
|
965
998
|
}
|
|
@@ -1018,7 +1051,13 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
1018
1051
|
if (stepChart || stepChart1) {
|
|
1019
1052
|
pp += getStepPath(data, i);
|
|
1020
1053
|
} else {
|
|
1021
|
-
pp += getSegmentPath(
|
|
1054
|
+
pp += getSegmentPath(
|
|
1055
|
+
data,
|
|
1056
|
+
i,
|
|
1057
|
+
lineSegments,
|
|
1058
|
+
startIndex1,
|
|
1059
|
+
endIndex1,
|
|
1060
|
+
);
|
|
1022
1061
|
}
|
|
1023
1062
|
}
|
|
1024
1063
|
if (data2.length && i >= startIndex2 && i <= endIndex2) {
|
|
@@ -1026,28 +1065,52 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
1026
1065
|
pp2 += getStepPath(data2, i);
|
|
1027
1066
|
(' ');
|
|
1028
1067
|
} else {
|
|
1029
|
-
pp2 += getSegmentPath(
|
|
1068
|
+
pp2 += getSegmentPath(
|
|
1069
|
+
data2,
|
|
1070
|
+
i,
|
|
1071
|
+
lineSegments2,
|
|
1072
|
+
startIndex2,
|
|
1073
|
+
endIndex2,
|
|
1074
|
+
);
|
|
1030
1075
|
}
|
|
1031
1076
|
}
|
|
1032
1077
|
if (data3.length && i >= startIndex3 && i <= endIndex3) {
|
|
1033
1078
|
if (stepChart || stepChart3) {
|
|
1034
1079
|
pp3 += getStepPath(data3, i);
|
|
1035
1080
|
} else {
|
|
1036
|
-
pp3 += getSegmentPath(
|
|
1081
|
+
pp3 += getSegmentPath(
|
|
1082
|
+
data2,
|
|
1083
|
+
i,
|
|
1084
|
+
lineSegments2,
|
|
1085
|
+
startIndex3,
|
|
1086
|
+
endIndex3,
|
|
1087
|
+
);
|
|
1037
1088
|
}
|
|
1038
1089
|
}
|
|
1039
1090
|
if (data4.length && i >= startIndex4 && i <= endIndex4) {
|
|
1040
1091
|
if (stepChart || stepChart4) {
|
|
1041
1092
|
pp4 += getStepPath(data4, i);
|
|
1042
1093
|
} else {
|
|
1043
|
-
pp4 += getSegmentPath(
|
|
1094
|
+
pp4 += getSegmentPath(
|
|
1095
|
+
data4,
|
|
1096
|
+
i,
|
|
1097
|
+
lineSegments4,
|
|
1098
|
+
startIndex4,
|
|
1099
|
+
endIndex4,
|
|
1100
|
+
);
|
|
1044
1101
|
}
|
|
1045
1102
|
}
|
|
1046
1103
|
if (data5.length && i >= startIndex5 && i <= endIndex5) {
|
|
1047
1104
|
if (stepChart || stepChart5) {
|
|
1048
1105
|
pp5 += getStepPath(data5, i);
|
|
1049
1106
|
} else {
|
|
1050
|
-
pp5 += getSegmentPath(
|
|
1107
|
+
pp5 += getSegmentPath(
|
|
1108
|
+
data5,
|
|
1109
|
+
i,
|
|
1110
|
+
lineSegments5,
|
|
1111
|
+
startIndex5,
|
|
1112
|
+
endIndex4,
|
|
1113
|
+
);
|
|
1051
1114
|
}
|
|
1052
1115
|
}
|
|
1053
1116
|
}
|
|
@@ -1271,11 +1334,46 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
1271
1334
|
let xx4 = svgPath(p4Array, curveType, curvature);
|
|
1272
1335
|
let xx5 = svgPath(p5Array, curveType, curvature);
|
|
1273
1336
|
|
|
1274
|
-
setPoints(
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1337
|
+
setPoints(
|
|
1338
|
+
getCurvePathWithSegments(
|
|
1339
|
+
xx,
|
|
1340
|
+
lineSegments,
|
|
1341
|
+
SEGMENT_START,
|
|
1342
|
+
SEGMENT_END,
|
|
1343
|
+
),
|
|
1344
|
+
);
|
|
1345
|
+
setPoints2(
|
|
1346
|
+
getCurvePathWithSegments(
|
|
1347
|
+
xx2,
|
|
1348
|
+
lineSegments2,
|
|
1349
|
+
SEGMENT_START,
|
|
1350
|
+
SEGMENT_END,
|
|
1351
|
+
),
|
|
1352
|
+
);
|
|
1353
|
+
setPoints3(
|
|
1354
|
+
getCurvePathWithSegments(
|
|
1355
|
+
xx3,
|
|
1356
|
+
lineSegments3,
|
|
1357
|
+
SEGMENT_START,
|
|
1358
|
+
SEGMENT_END,
|
|
1359
|
+
),
|
|
1360
|
+
);
|
|
1361
|
+
setPoints4(
|
|
1362
|
+
getCurvePathWithSegments(
|
|
1363
|
+
xx4,
|
|
1364
|
+
lineSegments4,
|
|
1365
|
+
SEGMENT_START,
|
|
1366
|
+
SEGMENT_END,
|
|
1367
|
+
),
|
|
1368
|
+
);
|
|
1369
|
+
setPoints5(
|
|
1370
|
+
getCurvePathWithSegments(
|
|
1371
|
+
xx5,
|
|
1372
|
+
lineSegments5,
|
|
1373
|
+
SEGMENT_START,
|
|
1374
|
+
SEGMENT_END,
|
|
1375
|
+
),
|
|
1376
|
+
);
|
|
1279
1377
|
|
|
1280
1378
|
if (data.length > 1 && (props.showArrow1 || props.showArrows)) {
|
|
1281
1379
|
let arrowTipY = p1Array[p1Array.length - 1][1];
|
|
@@ -1691,6 +1789,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
1691
1789
|
const hideSecondaryPointer =
|
|
1692
1790
|
pointerConfig?.hideSecondaryPointer ??
|
|
1693
1791
|
defaultPointerConfig.hideSecondaryPointer;
|
|
1792
|
+
const pointerEvents = pointerConfig?.pointerEvents;
|
|
1694
1793
|
const disableScroll =
|
|
1695
1794
|
props.disableScroll ||
|
|
1696
1795
|
(pointerConfig
|
|
@@ -2263,6 +2362,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
2263
2362
|
pointerLabelComponent,
|
|
2264
2363
|
secondaryPointerItem,
|
|
2265
2364
|
scrollX,
|
|
2365
|
+
pointerEvents,
|
|
2266
2366
|
});
|
|
2267
2367
|
};
|
|
2268
2368
|
|
|
@@ -2330,7 +2430,19 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
2330
2430
|
if (!points) return null;
|
|
2331
2431
|
const isCurved = points.includes('C');
|
|
2332
2432
|
let ar: [any] = [{}];
|
|
2333
|
-
if (points.includes(
|
|
2433
|
+
if (points.includes(RANGE_ENTER)) {
|
|
2434
|
+
ar = getRegionPathObjects(
|
|
2435
|
+
points,
|
|
2436
|
+
color,
|
|
2437
|
+
currentLineThickness,
|
|
2438
|
+
thickness,
|
|
2439
|
+
strokeDashArray,
|
|
2440
|
+
isCurved,
|
|
2441
|
+
RANGE_ENTER,
|
|
2442
|
+
STOP,
|
|
2443
|
+
RANGE_EXIT,
|
|
2444
|
+
);
|
|
2445
|
+
} else if (points.includes(SEGMENT_START)) {
|
|
2334
2446
|
ar = getSegmentedPathObjects(
|
|
2335
2447
|
points,
|
|
2336
2448
|
color,
|
|
@@ -2338,6 +2450,8 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
2338
2450
|
thickness,
|
|
2339
2451
|
strokeDashArray,
|
|
2340
2452
|
isCurved,
|
|
2453
|
+
SEGMENT_START,
|
|
2454
|
+
SEGMENT_END,
|
|
2341
2455
|
);
|
|
2342
2456
|
}
|
|
2343
2457
|
const lineSvgPropsOuter: LineSvgProps = {
|
|
@@ -2361,7 +2475,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
2361
2475
|
return (
|
|
2362
2476
|
<Svg>
|
|
2363
2477
|
{lineGradient && getLineGradientComponent()}
|
|
2364
|
-
{points.includes(
|
|
2478
|
+
{points.includes(SEGMENT_START) || points.includes(RANGE_ENTER) ? (
|
|
2365
2479
|
ar.map((item, index) => {
|
|
2366
2480
|
const lineSvgProps: LineSvgProps = {
|
|
2367
2481
|
d: item.d,
|
|
@@ -3387,13 +3501,13 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
3387
3501
|
: null}
|
|
3388
3502
|
{pointerX > 0 ? (
|
|
3389
3503
|
<View
|
|
3390
|
-
pointerEvents=
|
|
3504
|
+
pointerEvents={pointerEvents ?? 'none'}
|
|
3391
3505
|
style={{
|
|
3392
3506
|
position: 'absolute',
|
|
3393
3507
|
height:
|
|
3394
3508
|
extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
|
|
3395
3509
|
bottom: 58 + labelsExtraHeight + xAxisLabelsVerticalShift,
|
|
3396
|
-
width: totalWidth,
|
|
3510
|
+
// width: totalWidth,
|
|
3397
3511
|
zIndex: 20,
|
|
3398
3512
|
}}>
|
|
3399
3513
|
{!stripOverPointer && renderStripAndLabel()}
|
package/src/LineChart/types.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
CurveType,
|
|
5
5
|
DataSet,
|
|
6
6
|
EdgePosition,
|
|
7
|
+
HighlightedRange,
|
|
7
8
|
LineSegment,
|
|
8
9
|
Pointer,
|
|
9
10
|
RuleType,
|
|
@@ -310,6 +311,7 @@ export type LineChartPropsType = {
|
|
|
310
311
|
lineSegments3?: Array<LineSegment>;
|
|
311
312
|
lineSegments4?: Array<LineSegment>;
|
|
312
313
|
lineSegments5?: Array<LineSegment>;
|
|
314
|
+
highlightedRange?: HighlightedRange;
|
|
313
315
|
};
|
|
314
316
|
|
|
315
317
|
type referenceConfigType = {
|
package/src/utils/constants.ts
CHANGED
|
@@ -24,12 +24,25 @@ export enum yAxisSides {
|
|
|
24
24
|
RIGHT,
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export enum loc {
|
|
28
|
+
IN,
|
|
29
|
+
UP,
|
|
30
|
+
DOWN
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const SEGMENT_START = 'segmentStart';
|
|
34
|
+
export const SEGMENT_END = 'segmentEnd';
|
|
35
|
+
export const RANGE_ENTER = 'RangeEnter';
|
|
36
|
+
export const RANGE_EXIT = 'RangeExit';
|
|
37
|
+
export const STOP = 'stop';
|
|
38
|
+
|
|
27
39
|
export const ruleTypes: RuleTypes = {
|
|
28
40
|
SOLID: 'solid',
|
|
29
41
|
DASHED: 'dashed',
|
|
30
42
|
DOTTED: 'dotted',
|
|
31
43
|
};
|
|
32
44
|
|
|
45
|
+
|
|
33
46
|
export const AxesAndRulesDefaults = {
|
|
34
47
|
yAxisSide: yAxisSides.LEFT,
|
|
35
48
|
yAxisColor: 'black',
|
|
@@ -239,6 +252,7 @@ export const defaultPointerConfig = {
|
|
|
239
252
|
hidePointer5: false,
|
|
240
253
|
hideSecondaryPointer: false,
|
|
241
254
|
barTouchable: false,
|
|
255
|
+
// pointerEvents: PointerEvent
|
|
242
256
|
};
|
|
243
257
|
|
|
244
258
|
// Pie chart specific
|
package/src/utils/index.tsx
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
RANGE_ENTER,
|
|
3
|
+
RANGE_EXIT,
|
|
4
|
+
STOP,
|
|
5
|
+
defaultLineConfig,
|
|
6
|
+
loc,
|
|
7
|
+
} from './constants';
|
|
2
8
|
import {arrowConfigType, CurveType, LineProperties, LineSegment} from './types';
|
|
3
9
|
|
|
4
10
|
export const getCumulativeWidth = (
|
|
@@ -25,9 +31,6 @@ export const getLighterColor = (color: String) => {
|
|
|
25
31
|
r = parseInt(color[1], 16);
|
|
26
32
|
g = parseInt(color[2], 16);
|
|
27
33
|
b = parseInt(color[3], 16);
|
|
28
|
-
// console.log('r', r);
|
|
29
|
-
// console.log('g', g);
|
|
30
|
-
// console.log('b', b);
|
|
31
34
|
if (r < 14) {
|
|
32
35
|
r += 2;
|
|
33
36
|
lighter += r.toString(16);
|
|
@@ -40,14 +43,10 @@ export const getLighterColor = (color: String) => {
|
|
|
40
43
|
b += 2;
|
|
41
44
|
lighter += b.toString(16);
|
|
42
45
|
}
|
|
43
|
-
// console.log('lighter', lighter);
|
|
44
46
|
} else {
|
|
45
47
|
r = parseInt(color[1] + color[2], 16);
|
|
46
48
|
g = parseInt(color[3] + color[4], 16);
|
|
47
49
|
b = parseInt(color[5] + color[6], 16);
|
|
48
|
-
// console.log('r', r);
|
|
49
|
-
// console.log('g', g);
|
|
50
|
-
// console.log('b', b);
|
|
51
50
|
|
|
52
51
|
if (r < 224) {
|
|
53
52
|
r += 32;
|
|
@@ -61,7 +60,6 @@ export const getLighterColor = (color: String) => {
|
|
|
61
60
|
b += 32;
|
|
62
61
|
lighter += b.toString(16);
|
|
63
62
|
}
|
|
64
|
-
// console.log('lighter', lighter);
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
return lighter;
|
|
@@ -166,14 +164,21 @@ export const bezierCommand = (
|
|
|
166
164
|
return `C${cpsX},${cpsY} ${cpeX},${cpeY} ${point[0]},${point[1]}`;
|
|
167
165
|
};
|
|
168
166
|
|
|
169
|
-
export const getSegmentString = (
|
|
167
|
+
export const getSegmentString = (
|
|
168
|
+
lineSegment,
|
|
169
|
+
index,
|
|
170
|
+
startDelimeter,
|
|
171
|
+
endDelimeter,
|
|
172
|
+
) => {
|
|
170
173
|
const segment = lineSegment?.find(segment => segment.startIndex === index);
|
|
171
|
-
return segment ?
|
|
174
|
+
return segment ? startDelimeter + JSON.stringify(segment) + endDelimeter : '';
|
|
172
175
|
};
|
|
173
176
|
|
|
174
177
|
export const getCurvePathWithSegments = (
|
|
175
178
|
path: string,
|
|
176
179
|
lineSegment: LineSegment[] | undefined,
|
|
180
|
+
startDelimeter,
|
|
181
|
+
endDelimeter,
|
|
177
182
|
) => {
|
|
178
183
|
if (!lineSegment?.length) return path;
|
|
179
184
|
let newPath = '';
|
|
@@ -183,7 +188,7 @@ export const getCurvePathWithSegments = (
|
|
|
183
188
|
newPath +=
|
|
184
189
|
(pathArray[i].startsWith('M') ? '' : 'C') +
|
|
185
190
|
pathArray[i] +
|
|
186
|
-
(segment ?
|
|
191
|
+
(segment ? startDelimeter + JSON.stringify(segment) + endDelimeter : '');
|
|
187
192
|
}
|
|
188
193
|
return newPath;
|
|
189
194
|
};
|
|
@@ -200,6 +205,249 @@ export const getPreviousSegmentsLastPoint = (isCurved, previousSegment) => {
|
|
|
200
205
|
);
|
|
201
206
|
};
|
|
202
207
|
|
|
208
|
+
export const getPathWithHighlight = (
|
|
209
|
+
data,
|
|
210
|
+
i,
|
|
211
|
+
highlightedRange,
|
|
212
|
+
startIndex,
|
|
213
|
+
endIndex,
|
|
214
|
+
getX,
|
|
215
|
+
getY,
|
|
216
|
+
) => {
|
|
217
|
+
let path = '';
|
|
218
|
+
const {from, to} = highlightedRange;
|
|
219
|
+
const currentPointRegion =
|
|
220
|
+
data[i].value < from ? loc.DOWN : data[i].value > to ? loc.UP : loc.IN;
|
|
221
|
+
|
|
222
|
+
if (i !== endIndex) {
|
|
223
|
+
const nextPointRegion =
|
|
224
|
+
data[i + 1].value < from
|
|
225
|
+
? loc.DOWN
|
|
226
|
+
: data[i + 1].value > to
|
|
227
|
+
? loc.UP
|
|
228
|
+
: loc.IN;
|
|
229
|
+
if (
|
|
230
|
+
currentPointRegion !== nextPointRegion ||
|
|
231
|
+
(i === startIndex && currentPointRegion === loc.IN)
|
|
232
|
+
) {
|
|
233
|
+
const x1 = getX(i),
|
|
234
|
+
y1 = getY(data[i].value),
|
|
235
|
+
x2 = getX(i + 1),
|
|
236
|
+
y2 = getY(data[i + 1].value);
|
|
237
|
+
|
|
238
|
+
let m = (y2 - y1) / (x2 - x1),
|
|
239
|
+
x,
|
|
240
|
+
y;
|
|
241
|
+
if (i === startIndex && currentPointRegion === loc.IN) {
|
|
242
|
+
// If the 1st point lies IN
|
|
243
|
+
y = y1;
|
|
244
|
+
x = x1;
|
|
245
|
+
|
|
246
|
+
path +=
|
|
247
|
+
'L' +
|
|
248
|
+
x +
|
|
249
|
+
' ' +
|
|
250
|
+
y +
|
|
251
|
+
' ' +
|
|
252
|
+
RANGE_ENTER +
|
|
253
|
+
JSON.stringify(highlightedRange) +
|
|
254
|
+
STOP;
|
|
255
|
+
|
|
256
|
+
if (nextPointRegion === loc.UP) {
|
|
257
|
+
y = getY(to);
|
|
258
|
+
x = (y - y1) / m + x1;
|
|
259
|
+
|
|
260
|
+
path += 'L' + x + ' ' + y + ' ' + RANGE_EXIT;
|
|
261
|
+
} else if (nextPointRegion === loc.DOWN) {
|
|
262
|
+
y = getY(from);
|
|
263
|
+
x = (y - y1) / m + x1;
|
|
264
|
+
|
|
265
|
+
path += 'L' + x + ' ' + y + ' ' + RANGE_EXIT;
|
|
266
|
+
}
|
|
267
|
+
} else if (currentPointRegion !== nextPointRegion) {
|
|
268
|
+
if (currentPointRegion === loc.DOWN && nextPointRegion === loc.UP) {
|
|
269
|
+
// if current point is in DOWN and next point is in UP, then we will add 2 points to the the path
|
|
270
|
+
y = getY(from);
|
|
271
|
+
x = (y - y1) / m + x1;
|
|
272
|
+
|
|
273
|
+
path +=
|
|
274
|
+
'L' +
|
|
275
|
+
x +
|
|
276
|
+
' ' +
|
|
277
|
+
y +
|
|
278
|
+
' ' +
|
|
279
|
+
RANGE_ENTER +
|
|
280
|
+
JSON.stringify(highlightedRange) +
|
|
281
|
+
STOP;
|
|
282
|
+
y = getY(to);
|
|
283
|
+
x = (y - y1) / m + x1;
|
|
284
|
+
|
|
285
|
+
path += 'L' + x + ' ' + y + ' ' + RANGE_EXIT;
|
|
286
|
+
} else if (
|
|
287
|
+
currentPointRegion === loc.UP &&
|
|
288
|
+
nextPointRegion === loc.DOWN
|
|
289
|
+
) {
|
|
290
|
+
// if current point is in UP and next point is in DOWN, then we will add 2 points to the the path
|
|
291
|
+
y = getY(to);
|
|
292
|
+
x = (y - y1) / m + x1;
|
|
293
|
+
|
|
294
|
+
path +=
|
|
295
|
+
'L' +
|
|
296
|
+
x +
|
|
297
|
+
' ' +
|
|
298
|
+
y +
|
|
299
|
+
' ' +
|
|
300
|
+
RANGE_ENTER +
|
|
301
|
+
JSON.stringify(highlightedRange) +
|
|
302
|
+
STOP;
|
|
303
|
+
y = getY(from);
|
|
304
|
+
x = (y - y1) / m + x1;
|
|
305
|
+
|
|
306
|
+
path += 'L' + x + ' ' + y + ' ' + RANGE_EXIT;
|
|
307
|
+
} else {
|
|
308
|
+
if (
|
|
309
|
+
(currentPointRegion === loc.UP && nextPointRegion === loc.IN) ||
|
|
310
|
+
(currentPointRegion === loc.IN && nextPointRegion === loc.UP)
|
|
311
|
+
) {
|
|
312
|
+
y = getY(to);
|
|
313
|
+
} else if (
|
|
314
|
+
(currentPointRegion === loc.IN && nextPointRegion === loc.DOWN) ||
|
|
315
|
+
(currentPointRegion === loc.DOWN && nextPointRegion === loc.IN)
|
|
316
|
+
) {
|
|
317
|
+
y = getY(from);
|
|
318
|
+
}
|
|
319
|
+
m = (y2 - y1) / (x2 - x1);
|
|
320
|
+
x = (y - y1) / m + x1;
|
|
321
|
+
|
|
322
|
+
const prefix =
|
|
323
|
+
nextPointRegion === loc.IN
|
|
324
|
+
? RANGE_ENTER + JSON.stringify(highlightedRange) + STOP
|
|
325
|
+
: RANGE_EXIT;
|
|
326
|
+
|
|
327
|
+
path += 'L' + x + ' ' + y + ' ' + prefix;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
} else if (currentPointRegion === loc.IN) {
|
|
332
|
+
// If the last point lies IN, add RANGE_EXIT
|
|
333
|
+
path += RANGE_EXIT;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return path;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export const getRegionPathObjects = (
|
|
340
|
+
points,
|
|
341
|
+
color,
|
|
342
|
+
currentLineThickness,
|
|
343
|
+
thickness,
|
|
344
|
+
strokeDashArray,
|
|
345
|
+
isCurved,
|
|
346
|
+
startDelimeter,
|
|
347
|
+
stop,
|
|
348
|
+
endDelimeter,
|
|
349
|
+
) => {
|
|
350
|
+
const ar: [any] = [{}];
|
|
351
|
+
let tempStr = points;
|
|
352
|
+
|
|
353
|
+
if (!points.startsWith(startDelimeter)) {
|
|
354
|
+
/********************** line upto first segment *****************/
|
|
355
|
+
|
|
356
|
+
const lineSvgProps: LineProperties = {
|
|
357
|
+
d: points.substring(0, points.indexOf(startDelimeter)),
|
|
358
|
+
color,
|
|
359
|
+
strokeWidth: currentLineThickness || thickness,
|
|
360
|
+
};
|
|
361
|
+
if (strokeDashArray) {
|
|
362
|
+
lineSvgProps.strokeDashArray = strokeDashArray;
|
|
363
|
+
}
|
|
364
|
+
ar.push(lineSvgProps);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
while (tempStr.includes(startDelimeter)) {
|
|
368
|
+
const startDelimeterIndex = tempStr.indexOf(startDelimeter);
|
|
369
|
+
const stopIndex = tempStr.indexOf(stop);
|
|
370
|
+
const endDelimeterIndex = tempStr.indexOf(endDelimeter);
|
|
371
|
+
|
|
372
|
+
const segmentConfigString = tempStr.substring(
|
|
373
|
+
startDelimeterIndex + startDelimeter.length,
|
|
374
|
+
stopIndex,
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
const segmentConfig = JSON.parse(segmentConfigString);
|
|
378
|
+
|
|
379
|
+
let segment = tempStr.substring(stopIndex + stop.length, endDelimeterIndex);
|
|
380
|
+
|
|
381
|
+
const previousSegment = ar[ar.length - 1].d;
|
|
382
|
+
const moveToLastPointOfPreviousSegment = getPreviousSegmentsLastPoint(
|
|
383
|
+
isCurved,
|
|
384
|
+
previousSegment,
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
/********************** segment line *****************/
|
|
388
|
+
|
|
389
|
+
const lineSvgProps: LineProperties = {
|
|
390
|
+
d: moveToLastPointOfPreviousSegment + segment,
|
|
391
|
+
color: segmentConfig.color ?? color,
|
|
392
|
+
strokeWidth:
|
|
393
|
+
segmentConfig.thickness ?? (currentLineThickness || thickness),
|
|
394
|
+
};
|
|
395
|
+
if (segmentConfig.strokeDashArray) {
|
|
396
|
+
lineSvgProps.strokeDashArray = segmentConfig.strokeDashArray;
|
|
397
|
+
}
|
|
398
|
+
ar.push(lineSvgProps);
|
|
399
|
+
|
|
400
|
+
tempStr = tempStr.substring(endDelimeterIndex + endDelimeter.length);
|
|
401
|
+
|
|
402
|
+
const nextDelimiterIndex = tempStr.indexOf(startDelimeter);
|
|
403
|
+
const stringUptoNextSegment = tempStr.substring(0, nextDelimiterIndex);
|
|
404
|
+
|
|
405
|
+
/********************** line upto the next segment *****************/
|
|
406
|
+
|
|
407
|
+
if (
|
|
408
|
+
nextDelimiterIndex !== -1 &&
|
|
409
|
+
stringUptoNextSegment.indexOf(isCurved ? 'C' : 'L') !== -1
|
|
410
|
+
) {
|
|
411
|
+
const previousSegment = ar[ar.length - 1].d;
|
|
412
|
+
const moveToLastPointOfPreviousSegment = getPreviousSegmentsLastPoint(
|
|
413
|
+
isCurved,
|
|
414
|
+
previousSegment,
|
|
415
|
+
);
|
|
416
|
+
const lineSvgProps: LineProperties = {
|
|
417
|
+
d: moveToLastPointOfPreviousSegment + ' ' + stringUptoNextSegment,
|
|
418
|
+
color,
|
|
419
|
+
strokeWidth: currentLineThickness || thickness,
|
|
420
|
+
};
|
|
421
|
+
if (strokeDashArray) {
|
|
422
|
+
lineSvgProps.strokeDashArray = strokeDashArray;
|
|
423
|
+
}
|
|
424
|
+
ar.push(lineSvgProps);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/********************** line after the last segment *****************/
|
|
429
|
+
|
|
430
|
+
if (tempStr.length) {
|
|
431
|
+
const previousSegment = ar[ar.length - 1].d;
|
|
432
|
+
const moveToLastPointOfPreviousSegment = getPreviousSegmentsLastPoint(
|
|
433
|
+
isCurved,
|
|
434
|
+
previousSegment,
|
|
435
|
+
);
|
|
436
|
+
const lineSvgProps: LineProperties = {
|
|
437
|
+
d: moveToLastPointOfPreviousSegment + tempStr,
|
|
438
|
+
color,
|
|
439
|
+
strokeWidth: currentLineThickness || thickness,
|
|
440
|
+
};
|
|
441
|
+
if (strokeDashArray) {
|
|
442
|
+
lineSvgProps.strokeDashArray = strokeDashArray;
|
|
443
|
+
}
|
|
444
|
+
ar.push(lineSvgProps);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
ar.shift();
|
|
448
|
+
return ar;
|
|
449
|
+
};
|
|
450
|
+
|
|
203
451
|
export const getSegmentedPathObjects = (
|
|
204
452
|
points,
|
|
205
453
|
color,
|
|
@@ -207,15 +455,17 @@ export const getSegmentedPathObjects = (
|
|
|
207
455
|
thickness,
|
|
208
456
|
strokeDashArray,
|
|
209
457
|
isCurved,
|
|
458
|
+
startDelimeter,
|
|
459
|
+
endDelimeter,
|
|
210
460
|
) => {
|
|
211
461
|
const ar: [any] = [{}];
|
|
212
462
|
let tempStr = points;
|
|
213
463
|
|
|
214
|
-
if (!points.startsWith(
|
|
464
|
+
if (!points.startsWith(startDelimeter)) {
|
|
215
465
|
/********************** line upto first segment *****************/
|
|
216
466
|
|
|
217
467
|
const lineSvgProps: LineProperties = {
|
|
218
|
-
d: points.substring(0, points.indexOf(
|
|
468
|
+
d: points.substring(0, points.indexOf(startDelimeter)),
|
|
219
469
|
color,
|
|
220
470
|
strokeWidth: currentLineThickness || thickness,
|
|
221
471
|
};
|
|
@@ -225,20 +475,20 @@ export const getSegmentedPathObjects = (
|
|
|
225
475
|
ar.push(lineSvgProps);
|
|
226
476
|
}
|
|
227
477
|
|
|
228
|
-
while (tempStr.includes(
|
|
229
|
-
const startDelimeterIndex = tempStr.indexOf(
|
|
230
|
-
const endDelimeterIndex = tempStr.indexOf(
|
|
478
|
+
while (tempStr.includes(startDelimeter)) {
|
|
479
|
+
const startDelimeterIndex = tempStr.indexOf(startDelimeter);
|
|
480
|
+
const endDelimeterIndex = tempStr.indexOf(endDelimeter);
|
|
231
481
|
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
endDelimeterIndex,
|
|
236
|
-
),
|
|
482
|
+
const segmentConfigString = tempStr.substring(
|
|
483
|
+
startDelimeterIndex + startDelimeter.length,
|
|
484
|
+
endDelimeterIndex,
|
|
237
485
|
);
|
|
238
486
|
|
|
487
|
+
const segmentConfig = JSON.parse(segmentConfigString);
|
|
488
|
+
|
|
239
489
|
const {startIndex, endIndex} = segmentConfig;
|
|
240
490
|
const segmentLength = endIndex - startIndex;
|
|
241
|
-
let segment = tempStr.substring(endDelimeterIndex +
|
|
491
|
+
let segment = tempStr.substring(endDelimeterIndex + endDelimeter.length);
|
|
242
492
|
let c = 0,
|
|
243
493
|
s = 0,
|
|
244
494
|
i;
|
|
@@ -270,9 +520,9 @@ export const getSegmentedPathObjects = (
|
|
|
270
520
|
}
|
|
271
521
|
ar.push(lineSvgProps);
|
|
272
522
|
|
|
273
|
-
tempStr = tempStr.substring(endDelimeterIndex +
|
|
523
|
+
tempStr = tempStr.substring(endDelimeterIndex + endDelimeter.length + i);
|
|
274
524
|
|
|
275
|
-
const nextDelimiterIndex = tempStr.indexOf(
|
|
525
|
+
const nextDelimiterIndex = tempStr.indexOf(startDelimeter);
|
|
276
526
|
const stringUptoNextSegment = tempStr.substring(0, nextDelimiterIndex);
|
|
277
527
|
|
|
278
528
|
/********************** line upto the next segment *****************/
|
|
@@ -380,6 +630,7 @@ export const getAxesAndRulesProps = (
|
|
|
380
630
|
xAxisColor: props.xAxisColor,
|
|
381
631
|
xAxisLength: props.xAxisLength,
|
|
382
632
|
xAxisType: props.xAxisType,
|
|
633
|
+
xAxisTextNumberOfLines: props.xAxisTextNumberOfLines ?? 1,
|
|
383
634
|
xAxisLabelsHeight: props.xAxisLabelsHeight,
|
|
384
635
|
xAxisLabelsVerticalShift: props.xAxisLabelsVerticalShift,
|
|
385
636
|
dashWidth: props.dashWidth,
|
package/src/utils/types.ts
CHANGED
|
@@ -29,6 +29,8 @@ export type RulesConfig = {
|
|
|
29
29
|
dashGap?: number;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
export type PointerEvents = 'box-none' | 'none' | 'box-only' | 'auto';
|
|
33
|
+
|
|
32
34
|
export type secondaryYAxisType = {
|
|
33
35
|
noOfSections?: number;
|
|
34
36
|
maxValue?: number;
|
|
@@ -274,6 +276,15 @@ export type Pointer = {
|
|
|
274
276
|
hideSecondaryPointer?: boolean;
|
|
275
277
|
strokeDashArray?: Array<number>;
|
|
276
278
|
barTouchable?: boolean;
|
|
279
|
+
pointerEvents?: PointerEvents;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export type HighlightedRange = {
|
|
283
|
+
from: number;
|
|
284
|
+
to: number;
|
|
285
|
+
color?: string | ColorValue;
|
|
286
|
+
thickness?: number;
|
|
287
|
+
strokeDashArray?: Array<number>;
|
|
277
288
|
};
|
|
278
289
|
|
|
279
290
|
export type LineSegment = {
|