gifted-charts-core 0.0.1 → 0.0.3
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/index.ts +3 -1
- package/package.json +1 -1
- package/src/BarChart/Animated2DWithGradient.ts +7 -0
- package/src/BarChart/index.ts +145 -7
- package/src/BarChart/types.ts +3 -0
- package/src/LineChart/LineChartBiColor.ts +72 -2
- package/src/LineChart/index.ts +72 -1
- package/src/LineChart/types.ts +3 -0
- package/src/PieChart/main.ts +2 -7
- package/src/PieChart/types.ts +5 -0
- package/src/components/AnimatedThreeDBar/index.tsx +3 -3
- package/src/components/BarAndLineChartsWrapper/getHorizSectionsVals.ts +43 -1
- package/src/utils/constants.ts +3 -3
- package/src/utils/types.ts +7 -4
package/index.ts
CHANGED
|
@@ -36,7 +36,7 @@ export {
|
|
|
36
36
|
|
|
37
37
|
export { usePieChart } from "./src/PieChart";
|
|
38
38
|
export { getPieChartMainProps } from "./src/PieChart/main";
|
|
39
|
-
export { PieChartPropsType, pieDataItem } from "./src/PieChart/types";
|
|
39
|
+
export { PieChartPropsType, pieDataItem, PieChartMainProps } from "./src/PieChart/types";
|
|
40
40
|
|
|
41
41
|
/***********************************************************************************************************************/
|
|
42
42
|
/************************************ Population Pyramid Chart ************************************/
|
|
@@ -115,6 +115,8 @@ export {
|
|
|
115
115
|
RuleType,
|
|
116
116
|
RuleTypes,
|
|
117
117
|
RulesConfig,
|
|
118
|
+
CurveType,
|
|
119
|
+
EdgePosition,
|
|
118
120
|
PointerEvents,
|
|
119
121
|
secondaryYAxisType,
|
|
120
122
|
secondaryLineConfigType,
|
package/package.json
CHANGED
|
@@ -84,6 +84,12 @@ export const getPropsForAnimated2DWithGradient = (props) => {
|
|
|
84
84
|
borderTopRightRadius: (item.barWidth || barWidth || 30) / 2,
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
+
const barStyleWithBackground: ViewStyle[] = [
|
|
88
|
+
...commonStyleForBar,
|
|
89
|
+
{
|
|
90
|
+
backgroundColor: item.frontColor || props.frontColor || "black",
|
|
91
|
+
},
|
|
92
|
+
];
|
|
87
93
|
|
|
88
94
|
const commonPropsFor2Dand3Dbars = {
|
|
89
95
|
barBackgroundPattern: item.barBackgroundPattern || barBackgroundPattern,
|
|
@@ -107,6 +113,7 @@ export const getPropsForAnimated2DWithGradient = (props) => {
|
|
|
107
113
|
|
|
108
114
|
return {
|
|
109
115
|
commonStyleForBar,
|
|
116
|
+
barStyleWithBackground,
|
|
110
117
|
commonPropsFor2Dand3Dbars,
|
|
111
118
|
};
|
|
112
119
|
};
|
package/src/BarChart/index.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useEffect,
|
|
3
|
-
useMemo,
|
|
4
|
-
useState,
|
|
5
|
-
} from "react";
|
|
1
|
+
import { useEffect, useMemo, useState } from "react";
|
|
6
2
|
import { BarChartPropsType, barDataItem } from "./types";
|
|
7
3
|
import {
|
|
8
4
|
getArrowPoints,
|
|
5
|
+
getAxesAndRulesProps,
|
|
9
6
|
getExtendedContainerHeightWithPadding,
|
|
10
7
|
getLineConfigForBarChart,
|
|
11
8
|
getSecondaryDataWithOffsetIncluded,
|
|
@@ -17,9 +14,11 @@ import {
|
|
|
17
14
|
import {
|
|
18
15
|
AxesAndRulesDefaults,
|
|
19
16
|
BarDefaults,
|
|
17
|
+
chartTypes,
|
|
20
18
|
defaultLineConfig,
|
|
21
19
|
defaultPointerConfig,
|
|
22
20
|
} from "../utils/constants";
|
|
21
|
+
import { BarAndLineChartsWrapperTypes } from "../utils/types";
|
|
23
22
|
|
|
24
23
|
interface extendedBarChartPropsType extends BarChartPropsType {
|
|
25
24
|
heightValue;
|
|
@@ -28,8 +27,7 @@ interface extendedBarChartPropsType extends BarChartPropsType {
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
31
|
-
const { heightValue, widthValue, opacValue } =
|
|
32
|
-
props;
|
|
30
|
+
const { heightValue, widthValue, opacValue } = props;
|
|
33
31
|
const [points, setPoints] = useState("");
|
|
34
32
|
const [points2, setPoints2] = useState("");
|
|
35
33
|
const [arrowPoints, setArrowPoints] = useState("");
|
|
@@ -554,6 +552,140 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
554
552
|
outputRange: [0, totalWidth],
|
|
555
553
|
});
|
|
556
554
|
|
|
555
|
+
const getPropsCommonForBarAndStack = (item, index) => {
|
|
556
|
+
return {
|
|
557
|
+
key: index,
|
|
558
|
+
item: item,
|
|
559
|
+
index: index,
|
|
560
|
+
containerHeight: containerHeight,
|
|
561
|
+
maxValue: maxValue,
|
|
562
|
+
spacing: item.spacing ?? spacing,
|
|
563
|
+
propSpacing: spacing,
|
|
564
|
+
xAxisThickness: xAxisThickness,
|
|
565
|
+
barWidth: props.barWidth,
|
|
566
|
+
opacity: opacity,
|
|
567
|
+
disablePress: item.disablePress || props.disablePress,
|
|
568
|
+
rotateLabel: rotateLabel,
|
|
569
|
+
showXAxisIndices: showXAxisIndices,
|
|
570
|
+
xAxisIndicesHeight: xAxisIndicesHeight,
|
|
571
|
+
xAxisIndicesWidth: xAxisIndicesWidth,
|
|
572
|
+
xAxisIndicesColor: xAxisIndicesColor,
|
|
573
|
+
horizontal: horizontal,
|
|
574
|
+
rtl: rtl,
|
|
575
|
+
intactTopLabel: intactTopLabel,
|
|
576
|
+
showValuesAsTopLabel: props.showValuesAsTopLabel,
|
|
577
|
+
topLabelContainerStyle: props.topLabelContainerStyle,
|
|
578
|
+
topLabelTextStyle: props.topLabelTextStyle,
|
|
579
|
+
barBorderWidth: props.barBorderWidth,
|
|
580
|
+
barBorderColor: barBorderColor,
|
|
581
|
+
barBorderRadius: props.barBorderRadius,
|
|
582
|
+
barBorderTopLeftRadius: props.barBorderTopLeftRadius,
|
|
583
|
+
barBorderTopRightRadius: props.barBorderTopRightRadius,
|
|
584
|
+
barBorderBottomLeftRadius: props.barBorderBottomLeftRadius,
|
|
585
|
+
barBorderBottomRightRadius: props.barBorderBottomRightRadius,
|
|
586
|
+
barInnerComponent,
|
|
587
|
+
color: props.color,
|
|
588
|
+
showGradient: props.showGradient,
|
|
589
|
+
gradientColor: props.gradientColor,
|
|
590
|
+
barBackgroundPattern: props.barBackgroundPattern,
|
|
591
|
+
patternId: props.patternId,
|
|
592
|
+
onPress: props.onPress,
|
|
593
|
+
xAxisTextNumberOfLines: xAxisTextNumberOfLines,
|
|
594
|
+
xAxisLabelsHeight: props.xAxisLabelsHeight,
|
|
595
|
+
xAxisLabelsVerticalShift,
|
|
596
|
+
renderTooltip: props.renderTooltip,
|
|
597
|
+
leftShiftForTooltip: props.leftShiftForTooltip || 0,
|
|
598
|
+
initialSpacing: initialSpacing,
|
|
599
|
+
selectedIndex: selectedIndex,
|
|
600
|
+
setSelectedIndex: setSelectedIndex,
|
|
601
|
+
activeOpacity: props.activeOpacity || 0.2,
|
|
602
|
+
|
|
603
|
+
leftShiftForLastIndexTooltip: props.leftShiftForLastIndexTooltip || 0,
|
|
604
|
+
label:
|
|
605
|
+
item.label ||
|
|
606
|
+
(props.xAxisLabelTexts && props.xAxisLabelTexts[index]
|
|
607
|
+
? props.xAxisLabelTexts[index]
|
|
608
|
+
: ""),
|
|
609
|
+
labelTextStyle: item.labelTextStyle || props.xAxisLabelTextStyle,
|
|
610
|
+
pointerConfig,
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
const barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes = {
|
|
615
|
+
chartType: chartTypes.BAR,
|
|
616
|
+
containerHeight,
|
|
617
|
+
noOfSectionsBelowXAxis,
|
|
618
|
+
stepHeight,
|
|
619
|
+
labelsExtraHeight,
|
|
620
|
+
yAxisLabelWidth,
|
|
621
|
+
horizontal,
|
|
622
|
+
rtl,
|
|
623
|
+
shiftX: props.shiftX ?? 0,
|
|
624
|
+
shiftY: props.shiftY ?? 0,
|
|
625
|
+
yAxisAtTop,
|
|
626
|
+
initialSpacing,
|
|
627
|
+
data,
|
|
628
|
+
stackData: props.stackData,
|
|
629
|
+
secondaryData: secondaryData,
|
|
630
|
+
barWidth: props.barWidth || BarDefaults.barWidth,
|
|
631
|
+
xAxisThickness,
|
|
632
|
+
totalWidth,
|
|
633
|
+
disableScroll,
|
|
634
|
+
showScrollIndicator,
|
|
635
|
+
scrollToEnd,
|
|
636
|
+
scrollToIndex: props.scrollToIndex,
|
|
637
|
+
scrollAnimation,
|
|
638
|
+
scrollEventThrottle,
|
|
639
|
+
indicatorColor: props.indicatorColor,
|
|
640
|
+
setSelectedIndex,
|
|
641
|
+
spacing,
|
|
642
|
+
showLine,
|
|
643
|
+
lineConfig,
|
|
644
|
+
lineConfig2,
|
|
645
|
+
maxValue,
|
|
646
|
+
lineData,
|
|
647
|
+
lineData2,
|
|
648
|
+
animatedWidth,
|
|
649
|
+
lineBehindBars,
|
|
650
|
+
points,
|
|
651
|
+
points2,
|
|
652
|
+
arrowPoints,
|
|
653
|
+
|
|
654
|
+
//horizSectionProps-
|
|
655
|
+
width: widthFromProps,
|
|
656
|
+
horizSections,
|
|
657
|
+
endSpacing,
|
|
658
|
+
horizontalRulesStyle,
|
|
659
|
+
noOfSections,
|
|
660
|
+
showFractionalValues,
|
|
661
|
+
|
|
662
|
+
axesAndRulesProps: getAxesAndRulesProps(
|
|
663
|
+
props,
|
|
664
|
+
stepValue,
|
|
665
|
+
secondaryMaxValue
|
|
666
|
+
),
|
|
667
|
+
|
|
668
|
+
yAxisLabelTexts: props.yAxisLabelTexts,
|
|
669
|
+
yAxisOffset: props.yAxisOffset,
|
|
670
|
+
rotateYAxisTexts: props.rotateYAxisTexts,
|
|
671
|
+
hideAxesAndRules: props.hideAxesAndRules,
|
|
672
|
+
|
|
673
|
+
showXAxisIndices,
|
|
674
|
+
xAxisIndicesHeight,
|
|
675
|
+
xAxisIndicesWidth,
|
|
676
|
+
xAxisIndicesColor,
|
|
677
|
+
|
|
678
|
+
// These are Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
679
|
+
pointerConfig,
|
|
680
|
+
getPointerProps,
|
|
681
|
+
pointerIndex,
|
|
682
|
+
pointerX,
|
|
683
|
+
pointerY,
|
|
684
|
+
|
|
685
|
+
endReached: props.endReached,
|
|
686
|
+
startReached: props.startReached,
|
|
687
|
+
};
|
|
688
|
+
|
|
557
689
|
return {
|
|
558
690
|
lineConfig,
|
|
559
691
|
hidePointer1,
|
|
@@ -592,6 +724,7 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
592
724
|
setPointerIndex,
|
|
593
725
|
maxValue,
|
|
594
726
|
responderStartTime,
|
|
727
|
+
responderActive,
|
|
595
728
|
setResponderActive,
|
|
596
729
|
activatePointersDelay,
|
|
597
730
|
persistPointer,
|
|
@@ -642,8 +775,11 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
642
775
|
animatedWidth,
|
|
643
776
|
lineBehindBars,
|
|
644
777
|
points,
|
|
778
|
+
setPoints,
|
|
645
779
|
points2,
|
|
780
|
+
setPoints2,
|
|
646
781
|
arrowPoints,
|
|
782
|
+
setArrowPoints,
|
|
647
783
|
horizSections,
|
|
648
784
|
endSpacing,
|
|
649
785
|
horizontalRulesStyle,
|
|
@@ -654,5 +790,7 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
654
790
|
secondaryMaxValue,
|
|
655
791
|
getPointerProps,
|
|
656
792
|
pointerIndex,
|
|
793
|
+
getPropsCommonForBarAndStack,
|
|
794
|
+
barAndLineChartsWrapperProps,
|
|
657
795
|
};
|
|
658
796
|
};
|
package/src/BarChart/types.ts
CHANGED
|
@@ -285,6 +285,9 @@ export type BarChartPropsType = {
|
|
|
285
285
|
pointerConfig?: Pointer;
|
|
286
286
|
getPointerProps?: Function;
|
|
287
287
|
formatYLabel?: (label: string) => string;
|
|
288
|
+
|
|
289
|
+
endReached?: () => void;
|
|
290
|
+
startReached?: () => void;
|
|
288
291
|
};
|
|
289
292
|
type lineConfigType = {
|
|
290
293
|
initialSpacing?: number;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from "react";
|
|
2
|
-
import { AxesAndRulesDefaults, LineDefaults } from "../utils/constants";
|
|
3
|
-
import { getExtendedContainerHeightWithPadding } from "../utils";
|
|
2
|
+
import { AxesAndRulesDefaults, LineDefaults, chartTypes } from "../utils/constants";
|
|
3
|
+
import { getAxesAndRulesProps, getExtendedContainerHeightWithPadding } from "../utils";
|
|
4
4
|
import { bicolorLineDataItem } from "./types";
|
|
5
|
+
import { BarAndLineChartsWrapperTypes } from "../utils/types";
|
|
5
6
|
|
|
6
7
|
let initialData: Array<bicolorLineDataItem> | null = null;
|
|
7
8
|
|
|
@@ -427,6 +428,74 @@ export const useLineChartBiColor = (props) => {
|
|
|
427
428
|
});
|
|
428
429
|
}
|
|
429
430
|
|
|
431
|
+
const barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes = {
|
|
432
|
+
chartType: chartTypes.LINE_BI_COLOR,
|
|
433
|
+
containerHeight,
|
|
434
|
+
noOfSectionsBelowXAxis,
|
|
435
|
+
stepHeight,
|
|
436
|
+
labelsExtraHeight,
|
|
437
|
+
yAxisLabelWidth,
|
|
438
|
+
horizontal,
|
|
439
|
+
rtl: false,
|
|
440
|
+
shiftX: 0,
|
|
441
|
+
shiftY: 0,
|
|
442
|
+
yAxisAtTop,
|
|
443
|
+
initialSpacing,
|
|
444
|
+
data,
|
|
445
|
+
stackData: undefined, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
446
|
+
secondaryData: [],
|
|
447
|
+
barWidth: 0, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
448
|
+
xAxisThickness,
|
|
449
|
+
totalWidth,
|
|
450
|
+
disableScroll,
|
|
451
|
+
showScrollIndicator,
|
|
452
|
+
scrollToEnd,
|
|
453
|
+
scrollToIndex: props.scrollToIndex,
|
|
454
|
+
scrollAnimation,
|
|
455
|
+
scrollEventThrottle,
|
|
456
|
+
indicatorColor: props.indicatorColor,
|
|
457
|
+
setSelectedIndex,
|
|
458
|
+
spacing,
|
|
459
|
+
showLine: false,
|
|
460
|
+
lineConfig: null, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
461
|
+
lineConfig2: null, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
462
|
+
maxValue,
|
|
463
|
+
lineData: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
464
|
+
lineData2: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
465
|
+
lineBehindBars: false,
|
|
466
|
+
points: pointsArray,
|
|
467
|
+
points2: '', // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
468
|
+
arrowPoints: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
469
|
+
remainingScrollViewProps: {},
|
|
470
|
+
|
|
471
|
+
//horizSectionProps-
|
|
472
|
+
width: props.width,
|
|
473
|
+
horizSections,
|
|
474
|
+
endSpacing,
|
|
475
|
+
horizontalRulesStyle,
|
|
476
|
+
noOfSections,
|
|
477
|
+
showFractionalValues,
|
|
478
|
+
|
|
479
|
+
axesAndRulesProps: getAxesAndRulesProps(props, stepValue, undefined),
|
|
480
|
+
|
|
481
|
+
yAxisLabelTexts: props.yAxisLabelTexts,
|
|
482
|
+
yAxisOffset: props.yAxisOffset,
|
|
483
|
+
rotateYAxisTexts: 0,
|
|
484
|
+
hideAxesAndRules: props.hideAxesAndRules,
|
|
485
|
+
|
|
486
|
+
showXAxisIndices,
|
|
487
|
+
xAxisIndicesHeight,
|
|
488
|
+
xAxisIndicesWidth,
|
|
489
|
+
xAxisIndicesColor,
|
|
490
|
+
|
|
491
|
+
// These are Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
492
|
+
pointerConfig: undefined,
|
|
493
|
+
getPointerProps: null,
|
|
494
|
+
pointerIndex: 0,
|
|
495
|
+
pointerX: 0,
|
|
496
|
+
pointerY: 0,
|
|
497
|
+
}
|
|
498
|
+
|
|
430
499
|
return {
|
|
431
500
|
toggle,
|
|
432
501
|
setToggle,
|
|
@@ -513,5 +582,6 @@ export const useLineChartBiColor = (props) => {
|
|
|
513
582
|
unFocusOnPressOut,
|
|
514
583
|
delayBeforeUnFocus,
|
|
515
584
|
horizSections,
|
|
585
|
+
barAndLineChartsWrapperProps,
|
|
516
586
|
};
|
|
517
587
|
};
|
package/src/LineChart/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
LineDefaults,
|
|
5
5
|
SEGMENT_END,
|
|
6
6
|
SEGMENT_START,
|
|
7
|
+
chartTypes,
|
|
7
8
|
defaultArrowConfig,
|
|
8
9
|
defaultPointerConfig,
|
|
9
10
|
screenWidth,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
computeMaxAndMinItems,
|
|
14
15
|
getAllArrowProperties,
|
|
15
16
|
getArrowPoints,
|
|
17
|
+
getAxesAndRulesProps,
|
|
16
18
|
getCurvePathWithSegments,
|
|
17
19
|
getExtendedContainerHeightWithPadding,
|
|
18
20
|
getPathWithHighlight,
|
|
@@ -21,7 +23,7 @@ import {
|
|
|
21
23
|
svgPath,
|
|
22
24
|
} from "../utils";
|
|
23
25
|
import { LineChartPropsType } from "./types";
|
|
24
|
-
import { EdgePosition } from "../utils/types";
|
|
26
|
+
import { BarAndLineChartsWrapperTypes, EdgePosition } from "../utils/types";
|
|
25
27
|
|
|
26
28
|
interface extendedLineChartPropsType extends LineChartPropsType {
|
|
27
29
|
animations;
|
|
@@ -1696,6 +1698,74 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
1696
1698
|
setPointerY5(y5);
|
|
1697
1699
|
};
|
|
1698
1700
|
|
|
1701
|
+
const barAndLineChartsWrapperProps:BarAndLineChartsWrapperTypes = {
|
|
1702
|
+
chartType: chartTypes.LINE,
|
|
1703
|
+
containerHeight,
|
|
1704
|
+
noOfSectionsBelowXAxis,
|
|
1705
|
+
stepHeight,
|
|
1706
|
+
labelsExtraHeight,
|
|
1707
|
+
yAxisLabelWidth,
|
|
1708
|
+
horizontal,
|
|
1709
|
+
rtl: false,
|
|
1710
|
+
shiftX: 0,
|
|
1711
|
+
shiftY: 0,
|
|
1712
|
+
yAxisAtTop,
|
|
1713
|
+
initialSpacing,
|
|
1714
|
+
data: data0 ?? data,
|
|
1715
|
+
stackData: undefined, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1716
|
+
secondaryData: secondaryData,
|
|
1717
|
+
barWidth: 0, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1718
|
+
xAxisThickness,
|
|
1719
|
+
totalWidth,
|
|
1720
|
+
disableScroll,
|
|
1721
|
+
showScrollIndicator,
|
|
1722
|
+
scrollToEnd,
|
|
1723
|
+
scrollToIndex: props.scrollToIndex,
|
|
1724
|
+
scrollAnimation,
|
|
1725
|
+
scrollEventThrottle,
|
|
1726
|
+
indicatorColor: props.indicatorColor,
|
|
1727
|
+
setSelectedIndex,
|
|
1728
|
+
spacing,
|
|
1729
|
+
showLine: false,
|
|
1730
|
+
lineConfig: null, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1731
|
+
lineConfig2: null, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1732
|
+
maxValue,
|
|
1733
|
+
lineData: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1734
|
+
lineData2: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1735
|
+
lineBehindBars: false,
|
|
1736
|
+
points,
|
|
1737
|
+
points2: '', // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1738
|
+
arrowPoints: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
1739
|
+
|
|
1740
|
+
//horizSectionProps-
|
|
1741
|
+
width: props.width,
|
|
1742
|
+
horizSections,
|
|
1743
|
+
endSpacing,
|
|
1744
|
+
horizontalRulesStyle,
|
|
1745
|
+
noOfSections,
|
|
1746
|
+
showFractionalValues,
|
|
1747
|
+
|
|
1748
|
+
axesAndRulesProps: getAxesAndRulesProps(props, stepValue, undefined),
|
|
1749
|
+
|
|
1750
|
+
yAxisLabelTexts: props.yAxisLabelTexts,
|
|
1751
|
+
yAxisOffset: props.yAxisOffset,
|
|
1752
|
+
rotateYAxisTexts: 0,
|
|
1753
|
+
hideAxesAndRules: props.hideAxesAndRules,
|
|
1754
|
+
|
|
1755
|
+
showXAxisIndices,
|
|
1756
|
+
xAxisIndicesHeight,
|
|
1757
|
+
xAxisIndicesWidth,
|
|
1758
|
+
xAxisIndicesColor,
|
|
1759
|
+
pointerConfig,
|
|
1760
|
+
getPointerProps,
|
|
1761
|
+
pointerIndex,
|
|
1762
|
+
pointerX,
|
|
1763
|
+
pointerY,
|
|
1764
|
+
|
|
1765
|
+
endReached: props.endReached,
|
|
1766
|
+
startReached: props.startReached,
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1699
1769
|
return {
|
|
1700
1770
|
curvature,
|
|
1701
1771
|
curveType,
|
|
@@ -2037,5 +2107,6 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
2037
2107
|
getPointerY,
|
|
2038
2108
|
initialisePointers,
|
|
2039
2109
|
setPointerConfig,
|
|
2110
|
+
barAndLineChartsWrapperProps,
|
|
2040
2111
|
};
|
|
2041
2112
|
};
|
package/src/LineChart/types.ts
CHANGED
|
@@ -315,6 +315,9 @@ export type LineChartPropsType = {
|
|
|
315
315
|
lineSegments4?: Array<LineSegment>;
|
|
316
316
|
lineSegments5?: Array<LineSegment>;
|
|
317
317
|
highlightedRange?: HighlightedRange;
|
|
318
|
+
|
|
319
|
+
endReached?: () => void;
|
|
320
|
+
startReached?: () => void;
|
|
318
321
|
};
|
|
319
322
|
|
|
320
323
|
export type lineDataItem = {
|
package/src/PieChart/main.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PieChartMainProps, pieDataItem } from "./types";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
setSelectedIndex: Function;
|
|
5
|
-
isBiggerPie?: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const getPieChartMainProps = (props: propTypes) => {
|
|
3
|
+
export const getPieChartMainProps = (props: PieChartMainProps) => {
|
|
9
4
|
const { isThreeD, isBiggerPie } = props;
|
|
10
5
|
const propData = props.data;
|
|
11
6
|
const data: Array<pieDataItem> = [];
|
package/src/PieChart/types.ts
CHANGED
|
@@ -18,9 +18,9 @@ export const useAnimatedThreeDBar = (props: animatedBarPropTypes) => {
|
|
|
18
18
|
return {
|
|
19
19
|
showGradient,
|
|
20
20
|
gradientColor,
|
|
21
|
-
frontColor,
|
|
22
|
-
sideColor,
|
|
23
|
-
topColor,
|
|
21
|
+
frontColor: frontColor?.toString()?.trim?.()?.length ? frontColor : BarDefaults.threeDBarFrontColor,
|
|
22
|
+
sideColor: sideColor?.toString()?.trim?.()?.length ? sideColor : BarDefaults.threeDBarSideColor,
|
|
23
|
+
topColor: topColor?.toString()?.trim?.()?.length ? topColor : BarDefaults.threeDBarTopColor,
|
|
24
24
|
opacity,
|
|
25
25
|
initialRender,
|
|
26
26
|
setInitialRender,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxesAndRulesDefaults } from "../../utils/constants";
|
|
2
2
|
import { HorizSectionsType, secondaryYAxisType } from "../../utils/types";
|
|
3
|
-
import { computeMaxAndMinItems } from "../../utils";
|
|
3
|
+
import { computeMaxAndMinItems, getLabelTextUtil } from "../../utils";
|
|
4
4
|
|
|
5
5
|
export const getHorizSectionVals = (props) => {
|
|
6
6
|
const {
|
|
@@ -43,6 +43,9 @@ export const getHorizSectionVals = (props) => {
|
|
|
43
43
|
stepValue,
|
|
44
44
|
roundToDigits,
|
|
45
45
|
|
|
46
|
+
yAxisOffset,
|
|
47
|
+
formatYLabel,
|
|
48
|
+
|
|
46
49
|
secondaryData,
|
|
47
50
|
secondaryYAxis,
|
|
48
51
|
} = props;
|
|
@@ -335,6 +338,43 @@ export const getHorizSectionVals = (props) => {
|
|
|
335
338
|
}
|
|
336
339
|
: defaultReferenceConfig;
|
|
337
340
|
|
|
341
|
+
const getLabelTexts = (val, index) => {
|
|
342
|
+
return getLabelTextUtil(
|
|
343
|
+
val,
|
|
344
|
+
index,
|
|
345
|
+
showFractionalValues,
|
|
346
|
+
yAxisLabelTexts,
|
|
347
|
+
yAxisOffset,
|
|
348
|
+
yAxisLabelPrefix,
|
|
349
|
+
yAxisLabelSuffix,
|
|
350
|
+
roundToDigits ?? AxesAndRulesDefaults.roundToDigits,
|
|
351
|
+
formatYLabel,
|
|
352
|
+
);
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
const getLabelTextsForSecondaryYAxis = (val, index) => {
|
|
356
|
+
const {
|
|
357
|
+
showFractionalValues,
|
|
358
|
+
yAxisLabelTexts,
|
|
359
|
+
yAxisOffset,
|
|
360
|
+
yAxisLabelPrefix,
|
|
361
|
+
yAxisLabelSuffix,
|
|
362
|
+
roundToDigits,
|
|
363
|
+
formatYLabel,
|
|
364
|
+
} = secondaryYAxisConfig;
|
|
365
|
+
return getLabelTextUtil(
|
|
366
|
+
val,
|
|
367
|
+
index,
|
|
368
|
+
showFractionalValues,
|
|
369
|
+
yAxisLabelTexts,
|
|
370
|
+
yAxisOffset,
|
|
371
|
+
yAxisLabelPrefix,
|
|
372
|
+
yAxisLabelSuffix,
|
|
373
|
+
roundToDigits ?? AxesAndRulesDefaults.roundToDigits,
|
|
374
|
+
formatYLabel,
|
|
375
|
+
);
|
|
376
|
+
};
|
|
377
|
+
|
|
338
378
|
return {
|
|
339
379
|
secondaryYAxisConfig,
|
|
340
380
|
horizSections,
|
|
@@ -351,5 +391,7 @@ export const getHorizSectionVals = (props) => {
|
|
|
351
391
|
referenceLine3Position,
|
|
352
392
|
horizSectionsBelow,
|
|
353
393
|
secondaryHorizSectionsBelow,
|
|
394
|
+
getLabelTexts,
|
|
395
|
+
getLabelTextsForSecondaryYAxis,
|
|
354
396
|
};
|
|
355
397
|
};
|
package/src/utils/constants.ts
CHANGED
|
@@ -146,9 +146,9 @@ export const BarDefaults = {
|
|
|
146
146
|
opacity: 1,
|
|
147
147
|
isThreeD: false,
|
|
148
148
|
threeDBarGradientColor: 'white',
|
|
149
|
-
threeDBarFrontColor: '#
|
|
150
|
-
threeDBarSideColor: '#
|
|
151
|
-
threeDBarTopColor: '#
|
|
149
|
+
threeDBarFrontColor: '#C0CA3A',
|
|
150
|
+
threeDBarSideColor: '#887A24',
|
|
151
|
+
threeDBarTopColor: '#D9E676',
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
export const defaultLineConfig: defaultLineConfigType = {
|
package/src/utils/types.ts
CHANGED
|
@@ -197,7 +197,7 @@ export type BarAndLineChartsWrapperTypes = {
|
|
|
197
197
|
rtl: boolean;
|
|
198
198
|
shiftX: number;
|
|
199
199
|
shiftY: number;
|
|
200
|
-
scrollRef
|
|
200
|
+
scrollRef?: any;
|
|
201
201
|
yAxisAtTop: boolean;
|
|
202
202
|
initialSpacing: number;
|
|
203
203
|
data: Array<any>;
|
|
@@ -220,13 +220,13 @@ export type BarAndLineChartsWrapperTypes = {
|
|
|
220
220
|
maxValue: number;
|
|
221
221
|
lineData: Array<any>;
|
|
222
222
|
lineData2: Array<any>;
|
|
223
|
-
animatedWidth
|
|
223
|
+
animatedWidth?: any;
|
|
224
224
|
lineBehindBars: boolean;
|
|
225
225
|
points: string | Array<any>;
|
|
226
226
|
points2: string | Array<any>;
|
|
227
227
|
arrowPoints: any;
|
|
228
|
-
renderChartContent
|
|
229
|
-
remainingScrollViewProps
|
|
228
|
+
renderChartContent?: any;
|
|
229
|
+
remainingScrollViewProps?: any;
|
|
230
230
|
|
|
231
231
|
width: number | undefined;
|
|
232
232
|
horizSections: HorizSectionsType;
|
|
@@ -253,6 +253,9 @@ export type BarAndLineChartsWrapperTypes = {
|
|
|
253
253
|
pointerY: number;
|
|
254
254
|
|
|
255
255
|
scrollEventThrottle: number;
|
|
256
|
+
|
|
257
|
+
endReached?: () => void;
|
|
258
|
+
startReached?: () => void;
|
|
256
259
|
};
|
|
257
260
|
|
|
258
261
|
export type Pointer = {
|