gifted-charts-core 0.0.25 → 0.0.27
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 +5 -1
- package/src/BarChart/Animated2DWithGradient.d.ts +24 -0
- package/src/BarChart/Animated2DWithGradient.js +108 -0
- package/src/BarChart/RenderStackBars.d.ts +27 -0
- package/src/BarChart/RenderStackBars.js +99 -0
- package/src/BarChart/index.d.ts +175 -0
- package/src/BarChart/index.js +611 -0
- package/src/BarChart/types.d.ts +570 -0
- package/src/BarChart/types.js +1 -0
- package/src/LineChart/LineChartBiColor.d.ts +104 -0
- package/src/LineChart/LineChartBiColor.js +520 -0
- package/src/LineChart/index.d.ts +383 -0
- package/src/LineChart/index.js +1397 -0
- package/src/LineChart/index.ts +4 -3
- package/src/LineChart/types.d.ts +531 -0
- package/src/LineChart/types.js +1 -0
- package/src/PieChart/index.d.ts +33 -0
- package/src/PieChart/index.js +119 -0
- package/src/PieChart/main.d.ts +49 -0
- package/src/PieChart/main.js +185 -0
- package/src/PieChart/types.d.ts +85 -0
- package/src/PieChart/types.js +1 -0
- package/src/PopulationPyramid/index.d.ts +137 -0
- package/src/PopulationPyramid/index.js +233 -0
- package/src/PopulationPyramid/index.ts +3 -3
- package/src/PopulationPyramid/types.d.ts +235 -0
- package/src/PopulationPyramid/types.js +1 -0
- package/src/PopulationPyramid/types.ts +4 -0
- package/src/components/AnimatedThreeDBar/index.d.ts +12 -0
- package/src/components/AnimatedThreeDBar/index.js +53 -0
- package/src/components/BarAndLineChartsWrapper/getHorizSectionsVals.d.ts +20 -0
- package/src/components/BarAndLineChartsWrapper/getHorizSectionsVals.js +217 -0
- package/src/components/BarAndLineChartsWrapper/index.d.ts +97 -0
- package/src/components/BarAndLineChartsWrapper/index.js +266 -0
- package/src/components/BarAndLineChartsWrapper/index.ts +5 -4
- package/src/components/common/StripAndLabel.d.ts +7 -0
- package/src/components/common/StripAndLabel.js +53 -0
- package/src/components/common/StripAndLabel.ts +2 -2
- package/src/components/common/types.d.ts +31 -0
- package/src/components/common/types.js +1 -0
- package/src/components/common/types.ts +1 -0
- package/src/index.d.ts +37 -0
- package/src/index.js +32 -0
- package/src/index.ts +146 -0
- package/src/utils/constants.d.ts +248 -0
- package/src/utils/constants.js +299 -0
- package/src/utils/constants.ts +0 -4
- package/src/utils/index.d.ts +89 -0
- package/src/utils/index.js +1008 -0
- package/src/utils/types.d.ts +337 -0
- package/src/utils/types.js +16 -0
- package/src/utils/types.ts +1 -0
- package/index.ts +0 -141
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { AxesAndRulesDefaults } from '../../utils/constants';
|
|
2
|
+
import { computeMaxAndMinItems, getLabelTextUtil } from '../../utils';
|
|
3
|
+
export var getHorizSectionVals = function (props) {
|
|
4
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
|
|
5
|
+
var width = props.width, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, totalWidth = props.totalWidth, endSpacing = props.endSpacing, yAxisSide = props.yAxisSide, noOfSections = props.noOfSections, yAxisLabelWidth = props.yAxisLabelWidth, yAxisLabelContainerStyle = props.yAxisLabelContainerStyle, yAxisThickness = props.yAxisThickness, yAxisColor = props.yAxisColor, yAxisExtraHeight = props.yAxisExtraHeight, trimYAxisAtTop = props.trimYAxisAtTop, dashWidth = props.dashWidth, dashGap = props.dashGap, rulesType = props.rulesType, rulesThickness = props.rulesThickness, spacing = props.spacing, showYAxisIndices = props.showYAxisIndices, yAxisIndicesHeight = props.yAxisIndicesHeight, yAxisIndicesWidth = props.yAxisIndicesWidth, yAxisIndicesColor = props.yAxisIndicesColor, hideOrigin = props.hideOrigin, hideYAxisText = props.hideYAxisText, showFractionalValues = props.showFractionalValues, yAxisTextNumberOfLines = props.yAxisTextNumberOfLines, yAxisLabelPrefix = props.yAxisLabelPrefix, yAxisLabelSuffix = props.yAxisLabelSuffix, yAxisTextStyle = props.yAxisTextStyle, containerHeight = props.containerHeight, maxValue = props.maxValue, referenceLinesConfig = props.referenceLinesConfig, yAxisLabelTexts = props.yAxisLabelTexts, stepValue = props.stepValue, roundToDigits = props.roundToDigits, yAxisOffset = props.yAxisOffset, formatYLabel = props.formatYLabel, secondaryData = props.secondaryData, secondaryYAxis = props.secondaryYAxis;
|
|
6
|
+
var yAxisExtraHeightAtTop = trimYAxisAtTop ? 0 : yAxisExtraHeight;
|
|
7
|
+
/***********************************************************************************************************************************
|
|
8
|
+
* *
|
|
9
|
+
***************************** secondary Y Axis related props computations ******************************
|
|
10
|
+
* *
|
|
11
|
+
***********************************************************************************************************************************/
|
|
12
|
+
var secondaryYAxisConfig = {
|
|
13
|
+
noOfSections: (_a = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.noOfSections) !== null && _a !== void 0 ? _a : noOfSections,
|
|
14
|
+
maxValue: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue,
|
|
15
|
+
mostNegativeValue: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.mostNegativeValue,
|
|
16
|
+
stepValue: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.stepValue,
|
|
17
|
+
stepHeight: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.stepHeight,
|
|
18
|
+
showFractionalValues: (_b = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.showFractionalValues) !== null && _b !== void 0 ? _b : showFractionalValues,
|
|
19
|
+
roundToDigits: (_c = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.roundToDigits) !== null && _c !== void 0 ? _c : roundToDigits,
|
|
20
|
+
noOfSectionsBelowXAxis: (_d = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.noOfSectionsBelowXAxis) !== null && _d !== void 0 ? _d : noOfSectionsBelowXAxis,
|
|
21
|
+
showYAxisIndices: (_e = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.showYAxisIndices) !== null && _e !== void 0 ? _e : showYAxisIndices,
|
|
22
|
+
yAxisIndicesHeight: (_f = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisIndicesHeight) !== null && _f !== void 0 ? _f : yAxisIndicesHeight,
|
|
23
|
+
yAxisIndicesWidth: (_g = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisIndicesWidth) !== null && _g !== void 0 ? _g : yAxisIndicesWidth,
|
|
24
|
+
yAxisIndicesColor: (_h = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisIndicesColor) !== null && _h !== void 0 ? _h : yAxisIndicesColor,
|
|
25
|
+
yAxisSide: (_j = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisSide) !== null && _j !== void 0 ? _j : yAxisSide,
|
|
26
|
+
yAxisOffset: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisOffset,
|
|
27
|
+
yAxisThickness: (_k = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisThickness) !== null && _k !== void 0 ? _k : yAxisThickness,
|
|
28
|
+
yAxisColor: (_l = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisColor) !== null && _l !== void 0 ? _l : yAxisColor,
|
|
29
|
+
yAxisLabelContainerStyle: (_m = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelContainerStyle) !== null && _m !== void 0 ? _m : yAxisLabelContainerStyle,
|
|
30
|
+
yAxisLabelTexts: (_o = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelTexts) !== null && _o !== void 0 ? _o : yAxisLabelTexts,
|
|
31
|
+
yAxisTextStyle: (_p = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisTextStyle) !== null && _p !== void 0 ? _p : yAxisTextStyle,
|
|
32
|
+
yAxisTextNumberOfLines: (_q = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisTextNumberOfLines) !== null && _q !== void 0 ? _q : yAxisTextNumberOfLines,
|
|
33
|
+
yAxisLabelWidth: (_r = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelWidth) !== null && _r !== void 0 ? _r : yAxisLabelWidth,
|
|
34
|
+
hideYAxisText: (_s = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.hideYAxisText) !== null && _s !== void 0 ? _s : hideYAxisText,
|
|
35
|
+
yAxisLabelPrefix: (_t = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelPrefix) !== null && _t !== void 0 ? _t : yAxisLabelPrefix,
|
|
36
|
+
yAxisLabelSuffix: (_u = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisLabelSuffix) !== null && _u !== void 0 ? _u : yAxisLabelSuffix,
|
|
37
|
+
hideOrigin: (_v = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.hideOrigin) !== null && _v !== void 0 ? _v : hideOrigin,
|
|
38
|
+
formatYLabel: secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.formatYLabel
|
|
39
|
+
};
|
|
40
|
+
var _20 = computeMaxAndMinItems(secondaryData, secondaryYAxisConfig.roundToDigits, secondaryYAxisConfig.showFractionalValues), maxItem = _20.maxItem, minItem = _20.minItem;
|
|
41
|
+
secondaryYAxisConfig.maxValue =
|
|
42
|
+
(_w = secondaryYAxisConfig.maxValue) !== null && _w !== void 0 ? _w : (maxItem || maxValue);
|
|
43
|
+
secondaryYAxisConfig.mostNegativeValue =
|
|
44
|
+
(_x = secondaryYAxisConfig.mostNegativeValue) !== null && _x !== void 0 ? _x : minItem;
|
|
45
|
+
secondaryYAxisConfig.stepValue =
|
|
46
|
+
(_y = secondaryYAxisConfig.stepValue) !== null && _y !== void 0 ? _y : ((_z = secondaryYAxisConfig.maxValue) !== null && _z !== void 0 ? _z : 0) /
|
|
47
|
+
((_0 = secondaryYAxisConfig.noOfSections) !== null && _0 !== void 0 ? _0 : noOfSections);
|
|
48
|
+
secondaryYAxisConfig.stepHeight =
|
|
49
|
+
secondaryYAxisConfig.stepHeight ||
|
|
50
|
+
containerHeight / ((_1 = secondaryYAxisConfig.noOfSections) !== null && _1 !== void 0 ? _1 : noOfSections);
|
|
51
|
+
var horizSections = [];
|
|
52
|
+
for (var i = 0; i <= noOfSections; i++) {
|
|
53
|
+
var value = maxValue - stepValue * i;
|
|
54
|
+
if (showFractionalValues || roundToDigits) {
|
|
55
|
+
value = parseFloat(value.toFixed(roundToDigits !== null && roundToDigits !== void 0 ? roundToDigits : AxesAndRulesDefaults.roundToDigits));
|
|
56
|
+
}
|
|
57
|
+
horizSections.push({
|
|
58
|
+
value: (yAxisLabelTexts === null || yAxisLabelTexts === void 0 ? void 0 : yAxisLabelTexts.length)
|
|
59
|
+
? (_2 = yAxisLabelTexts[noOfSections + noOfSectionsBelowXAxis - i]) !== null && _2 !== void 0 ? _2 : value.toString()
|
|
60
|
+
: value.toString()
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
var horizSectionsBelow = [];
|
|
64
|
+
if (noOfSectionsBelowXAxis) {
|
|
65
|
+
for (var i = 1; i <= noOfSectionsBelowXAxis; i++) {
|
|
66
|
+
var value = stepValue * -i;
|
|
67
|
+
if (showFractionalValues || roundToDigits) {
|
|
68
|
+
value = parseFloat(value.toFixed(roundToDigits !== null && roundToDigits !== void 0 ? roundToDigits : AxesAndRulesDefaults.roundToDigits));
|
|
69
|
+
}
|
|
70
|
+
horizSectionsBelow.push({
|
|
71
|
+
value: props.yAxisLabelTexts
|
|
72
|
+
? (_3 = props.yAxisLabelTexts[noOfSectionsBelowXAxis - i]) !== null && _3 !== void 0 ? _3 : value.toString()
|
|
73
|
+
: value.toString()
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
var secondaryHorizSections = [];
|
|
78
|
+
if (secondaryYAxis) {
|
|
79
|
+
for (var i = 0; i <= ((_4 = secondaryYAxisConfig.noOfSections) !== null && _4 !== void 0 ? _4 : noOfSections); i++) {
|
|
80
|
+
var value = secondaryYAxisConfig.stepValue * i;
|
|
81
|
+
if (secondaryYAxisConfig.showFractionalValues ||
|
|
82
|
+
secondaryYAxisConfig.roundToDigits) {
|
|
83
|
+
value = parseFloat(value.toFixed((_5 = secondaryYAxisConfig.roundToDigits) !== null && _5 !== void 0 ? _5 : AxesAndRulesDefaults.roundToDigits));
|
|
84
|
+
}
|
|
85
|
+
secondaryHorizSections.push({
|
|
86
|
+
value: ((_6 = secondaryYAxisConfig.yAxisLabelTexts) === null || _6 === void 0 ? void 0 : _6.length)
|
|
87
|
+
? (_7 = secondaryYAxisConfig.yAxisLabelTexts[i - noOfSectionsBelowXAxis - 1]) !== null && _7 !== void 0 ? _7 : value.toString()
|
|
88
|
+
: value.toString()
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
var secondaryHorizSectionsBelow = [];
|
|
93
|
+
if (secondaryYAxisConfig.noOfSectionsBelowXAxis) {
|
|
94
|
+
for (var i = 1; i <= secondaryYAxisConfig.noOfSectionsBelowXAxis; i++) {
|
|
95
|
+
var value = secondaryYAxisConfig.stepValue *
|
|
96
|
+
(i - secondaryYAxisConfig.noOfSectionsBelowXAxis - 1);
|
|
97
|
+
if (secondaryYAxisConfig.showFractionalValues ||
|
|
98
|
+
secondaryYAxisConfig.roundToDigits) {
|
|
99
|
+
value = parseFloat(value.toFixed((_8 = secondaryYAxisConfig.roundToDigits) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.roundToDigits));
|
|
100
|
+
}
|
|
101
|
+
secondaryHorizSectionsBelow.push({
|
|
102
|
+
value: ((_9 = secondaryYAxisConfig.yAxisLabelTexts) === null || _9 === void 0 ? void 0 : _9.length)
|
|
103
|
+
? (_10 = secondaryYAxisConfig.yAxisLabelTexts[i - 1]) !== null && _10 !== void 0 ? _10 : value.toString()
|
|
104
|
+
: value.toString()
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/***********************************************************************************************************************************
|
|
109
|
+
***********************************************************************************************************************************/
|
|
110
|
+
var showReferenceLine1 = referenceLinesConfig.showReferenceLine1, referenceLine1Position = referenceLinesConfig.referenceLine1Position, referenceLine1Config = referenceLinesConfig.referenceLine1Config, showReferenceLine2 = referenceLinesConfig.showReferenceLine2, referenceLine2Position = referenceLinesConfig.referenceLine2Position, referenceLine2Config = referenceLinesConfig.referenceLine2Config, showReferenceLine3 = referenceLinesConfig.showReferenceLine3, referenceLine3Position = referenceLinesConfig.referenceLine3Position, referenceLine3Config = referenceLinesConfig.referenceLine3Config;
|
|
111
|
+
var defaultReferenceConfig = {
|
|
112
|
+
thickness: rulesThickness,
|
|
113
|
+
width: (width || totalWidth - spacing) + endSpacing,
|
|
114
|
+
color: 'black',
|
|
115
|
+
type: rulesType,
|
|
116
|
+
dashWidth: dashWidth,
|
|
117
|
+
dashGap: dashGap,
|
|
118
|
+
labelText: '',
|
|
119
|
+
labelTextStyle: null,
|
|
120
|
+
zIndex: 1
|
|
121
|
+
};
|
|
122
|
+
showReferenceLine1 = referenceLinesConfig.showReferenceLine1 || false;
|
|
123
|
+
referenceLine1Position =
|
|
124
|
+
(_11 = referenceLinesConfig.referenceLine1Position) !== null && _11 !== void 0 ? _11 : (referenceLinesConfig.referenceLine1Position || containerHeight / 2);
|
|
125
|
+
referenceLine1Config = referenceLinesConfig.referenceLine1Config
|
|
126
|
+
? {
|
|
127
|
+
thickness: referenceLinesConfig.referenceLine1Config.thickness ||
|
|
128
|
+
defaultReferenceConfig.thickness,
|
|
129
|
+
width: (_12 = referenceLinesConfig.referenceLine1Config.width) !== null && _12 !== void 0 ? _12 : defaultReferenceConfig.width,
|
|
130
|
+
color: referenceLinesConfig.referenceLine1Config.color ||
|
|
131
|
+
defaultReferenceConfig.color,
|
|
132
|
+
type: referenceLinesConfig.referenceLine1Config.type ||
|
|
133
|
+
defaultReferenceConfig.type,
|
|
134
|
+
dashWidth: referenceLinesConfig.referenceLine1Config.dashWidth ||
|
|
135
|
+
defaultReferenceConfig.dashWidth,
|
|
136
|
+
dashGap: referenceLinesConfig.referenceLine1Config.dashGap ||
|
|
137
|
+
defaultReferenceConfig.dashGap,
|
|
138
|
+
labelText: referenceLinesConfig.referenceLine1Config.labelText ||
|
|
139
|
+
defaultReferenceConfig.labelText,
|
|
140
|
+
labelTextStyle: referenceLinesConfig.referenceLine1Config.labelTextStyle ||
|
|
141
|
+
defaultReferenceConfig.labelTextStyle,
|
|
142
|
+
zIndex: (_13 = referenceLinesConfig.referenceLine1Config.zIndex) !== null && _13 !== void 0 ? _13 : defaultReferenceConfig.zIndex
|
|
143
|
+
}
|
|
144
|
+
: defaultReferenceConfig;
|
|
145
|
+
showReferenceLine2 = referenceLinesConfig.showReferenceLine2 || false;
|
|
146
|
+
referenceLine2Position =
|
|
147
|
+
(_14 = referenceLinesConfig.referenceLine2Position) !== null && _14 !== void 0 ? _14 : (referenceLinesConfig.referenceLine2Position || (3 * containerHeight) / 2);
|
|
148
|
+
referenceLine2Config = referenceLinesConfig.referenceLine2Config
|
|
149
|
+
? {
|
|
150
|
+
thickness: referenceLinesConfig.referenceLine2Config.thickness ||
|
|
151
|
+
defaultReferenceConfig.thickness,
|
|
152
|
+
width: (_15 = referenceLinesConfig.referenceLine2Config.width) !== null && _15 !== void 0 ? _15 : defaultReferenceConfig.width,
|
|
153
|
+
color: referenceLinesConfig.referenceLine2Config.color ||
|
|
154
|
+
defaultReferenceConfig.color,
|
|
155
|
+
type: referenceLinesConfig.referenceLine2Config.type ||
|
|
156
|
+
defaultReferenceConfig.type,
|
|
157
|
+
dashWidth: referenceLinesConfig.referenceLine2Config.dashWidth ||
|
|
158
|
+
defaultReferenceConfig.dashWidth,
|
|
159
|
+
dashGap: referenceLinesConfig.referenceLine2Config.dashGap ||
|
|
160
|
+
defaultReferenceConfig.dashGap,
|
|
161
|
+
labelText: referenceLinesConfig.referenceLine2Config.labelText ||
|
|
162
|
+
defaultReferenceConfig.labelText,
|
|
163
|
+
labelTextStyle: referenceLinesConfig.referenceLine2Config.labelTextStyle ||
|
|
164
|
+
defaultReferenceConfig.labelTextStyle,
|
|
165
|
+
zIndex: (_16 = referenceLinesConfig.referenceLine2Config.zIndex) !== null && _16 !== void 0 ? _16 : defaultReferenceConfig.zIndex
|
|
166
|
+
}
|
|
167
|
+
: defaultReferenceConfig;
|
|
168
|
+
showReferenceLine3 = referenceLinesConfig.showReferenceLine3 || false;
|
|
169
|
+
referenceLine3Position =
|
|
170
|
+
(_17 = referenceLinesConfig.referenceLine3Position) !== null && _17 !== void 0 ? _17 : (referenceLinesConfig.referenceLine3Position || containerHeight / 3);
|
|
171
|
+
referenceLine3Config = referenceLinesConfig.referenceLine3Config
|
|
172
|
+
? {
|
|
173
|
+
thickness: referenceLinesConfig.referenceLine3Config.thickness ||
|
|
174
|
+
defaultReferenceConfig.thickness,
|
|
175
|
+
width: (_18 = referenceLinesConfig.referenceLine3Config.width) !== null && _18 !== void 0 ? _18 : defaultReferenceConfig.width,
|
|
176
|
+
color: referenceLinesConfig.referenceLine3Config.color ||
|
|
177
|
+
defaultReferenceConfig.color,
|
|
178
|
+
type: referenceLinesConfig.referenceLine3Config.type ||
|
|
179
|
+
defaultReferenceConfig.type,
|
|
180
|
+
dashWidth: referenceLinesConfig.referenceLine3Config.dashWidth ||
|
|
181
|
+
defaultReferenceConfig.dashWidth,
|
|
182
|
+
dashGap: referenceLinesConfig.referenceLine3Config.dashGap ||
|
|
183
|
+
defaultReferenceConfig.dashGap,
|
|
184
|
+
labelText: referenceLinesConfig.referenceLine3Config.labelText ||
|
|
185
|
+
defaultReferenceConfig.labelText,
|
|
186
|
+
labelTextStyle: referenceLinesConfig.referenceLine3Config.labelTextStyle ||
|
|
187
|
+
defaultReferenceConfig.labelTextStyle,
|
|
188
|
+
zIndex: (_19 = referenceLinesConfig.referenceLine3Config.zIndex) !== null && _19 !== void 0 ? _19 : defaultReferenceConfig.zIndex
|
|
189
|
+
}
|
|
190
|
+
: defaultReferenceConfig;
|
|
191
|
+
var getLabelTexts = function (val, index) {
|
|
192
|
+
return getLabelTextUtil(val, index, showFractionalValues, yAxisLabelTexts, yAxisOffset, yAxisLabelPrefix, yAxisLabelSuffix, roundToDigits !== null && roundToDigits !== void 0 ? roundToDigits : AxesAndRulesDefaults.roundToDigits, formatYLabel);
|
|
193
|
+
};
|
|
194
|
+
var getLabelTextsForSecondaryYAxis = function (val, index) {
|
|
195
|
+
var showFractionalValues = secondaryYAxisConfig.showFractionalValues, yAxisLabelTexts = secondaryYAxisConfig.yAxisLabelTexts, yAxisOffset = secondaryYAxisConfig.yAxisOffset, yAxisLabelPrefix = secondaryYAxisConfig.yAxisLabelPrefix, yAxisLabelSuffix = secondaryYAxisConfig.yAxisLabelSuffix, roundToDigits = secondaryYAxisConfig.roundToDigits, formatYLabel = secondaryYAxisConfig.formatYLabel;
|
|
196
|
+
return getLabelTextUtil(val, index, showFractionalValues, yAxisLabelTexts, yAxisOffset, yAxisLabelPrefix, yAxisLabelSuffix, roundToDigits !== null && roundToDigits !== void 0 ? roundToDigits : AxesAndRulesDefaults.roundToDigits, formatYLabel);
|
|
197
|
+
};
|
|
198
|
+
return {
|
|
199
|
+
secondaryYAxisConfig: secondaryYAxisConfig,
|
|
200
|
+
horizSections: horizSections,
|
|
201
|
+
yAxisExtraHeightAtTop: yAxisExtraHeightAtTop,
|
|
202
|
+
secondaryHorizSections: secondaryHorizSections,
|
|
203
|
+
showReferenceLine1: showReferenceLine1,
|
|
204
|
+
referenceLine1Config: referenceLine1Config,
|
|
205
|
+
referenceLine1Position: referenceLine1Position,
|
|
206
|
+
showReferenceLine2: showReferenceLine2,
|
|
207
|
+
referenceLine2Config: referenceLine2Config,
|
|
208
|
+
referenceLine2Position: referenceLine2Position,
|
|
209
|
+
showReferenceLine3: showReferenceLine3,
|
|
210
|
+
referenceLine3Config: referenceLine3Config,
|
|
211
|
+
referenceLine3Position: referenceLine3Position,
|
|
212
|
+
horizSectionsBelow: horizSectionsBelow,
|
|
213
|
+
secondaryHorizSectionsBelow: secondaryHorizSectionsBelow,
|
|
214
|
+
getLabelTexts: getLabelTexts,
|
|
215
|
+
getLabelTextsForSecondaryYAxis: getLabelTextsForSecondaryYAxis
|
|
216
|
+
};
|
|
217
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type BarAndLineChartsWrapperTypes, type horizSectionPropTypes } from '../../utils/types';
|
|
3
|
+
import { type NativeScrollEvent } from 'react-native';
|
|
4
|
+
export declare const useBarAndLineChartsWrapper: (props: BarAndLineChartsWrapperTypes) => {
|
|
5
|
+
containerHeightIncludingBelowXAxis: any;
|
|
6
|
+
xAxisLabelsVerticalShift: any;
|
|
7
|
+
trimYAxisAtTop: any;
|
|
8
|
+
yAxisExtraHeight: any;
|
|
9
|
+
overflowTop: any;
|
|
10
|
+
xAxisLabelsHeight: any;
|
|
11
|
+
xAxisTextNumberOfLines: any;
|
|
12
|
+
actualContainerWidth: number;
|
|
13
|
+
transformForHorizontal: ({
|
|
14
|
+
rotate: string;
|
|
15
|
+
translateY?: undefined;
|
|
16
|
+
translateX?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
translateY: number;
|
|
19
|
+
rotate?: undefined;
|
|
20
|
+
translateX?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
translateX: number;
|
|
23
|
+
rotate?: undefined;
|
|
24
|
+
translateY?: undefined;
|
|
25
|
+
})[];
|
|
26
|
+
horizSectionProps: horizSectionPropTypes;
|
|
27
|
+
referenceLinesOverChartContent: any;
|
|
28
|
+
setCanMomentum: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
29
|
+
isCloseToStart: ({ layoutMeasurement, contentOffset, contentSize }: NativeScrollEvent) => boolean;
|
|
30
|
+
isCloseToEnd: ({ layoutMeasurement, contentOffset, contentSize }: NativeScrollEvent) => boolean;
|
|
31
|
+
canMomentum: boolean;
|
|
32
|
+
yAxisAtTop: boolean;
|
|
33
|
+
yAxisThickness: any;
|
|
34
|
+
yAxisSide: any;
|
|
35
|
+
showVerticalLines: any;
|
|
36
|
+
verticalLinesProps: {
|
|
37
|
+
verticalLinesAr: number[];
|
|
38
|
+
verticalLinesSpacing: any;
|
|
39
|
+
spacing: any;
|
|
40
|
+
initialSpacing: number;
|
|
41
|
+
verticalLinesZIndex: any;
|
|
42
|
+
verticalLinesHeight: any;
|
|
43
|
+
verticalLinesThickness: any;
|
|
44
|
+
verticalLinesColor: any;
|
|
45
|
+
verticalLinesStrokeDashArray: any;
|
|
46
|
+
verticalLinesShift: any;
|
|
47
|
+
verticalLinesUptoDataPoint: any;
|
|
48
|
+
xAxisThickness: number;
|
|
49
|
+
labelsExtraHeight: number;
|
|
50
|
+
containerHeight: number;
|
|
51
|
+
data: any[];
|
|
52
|
+
stackData: any[] | undefined;
|
|
53
|
+
barWidth: number | undefined;
|
|
54
|
+
maxValue: number;
|
|
55
|
+
chartType: import("../../utils/constants").chartTypes;
|
|
56
|
+
containerHeightIncludingBelowXAxis: any;
|
|
57
|
+
yAxisLabelWidth: number;
|
|
58
|
+
totalWidth: number;
|
|
59
|
+
xAxisLabelsVerticalShift: any;
|
|
60
|
+
};
|
|
61
|
+
lineInBarChartProps: {
|
|
62
|
+
yAxisLabelWidth: number;
|
|
63
|
+
initialSpacing: number;
|
|
64
|
+
spacing: number;
|
|
65
|
+
containerHeight: number;
|
|
66
|
+
lineConfig: any;
|
|
67
|
+
maxValue: any;
|
|
68
|
+
animatedWidth: any;
|
|
69
|
+
lineBehindBars: boolean;
|
|
70
|
+
points: string | any[];
|
|
71
|
+
arrowPoints: any;
|
|
72
|
+
data: any[];
|
|
73
|
+
totalWidth: number;
|
|
74
|
+
barWidth: number | undefined;
|
|
75
|
+
labelsExtraHeight: number;
|
|
76
|
+
scrollEventThrottle: number;
|
|
77
|
+
xAxisLabelsVerticalShift: any;
|
|
78
|
+
};
|
|
79
|
+
lineInBarChartProps2: {
|
|
80
|
+
lineConfig: any;
|
|
81
|
+
points: string | any[];
|
|
82
|
+
data: (import("../..").lineDataItem | import("../..").barDataItem | import("../..").stackDataItem)[] | undefined;
|
|
83
|
+
yAxisLabelWidth: number;
|
|
84
|
+
initialSpacing: number;
|
|
85
|
+
spacing: number;
|
|
86
|
+
containerHeight: number;
|
|
87
|
+
maxValue: any;
|
|
88
|
+
animatedWidth: any;
|
|
89
|
+
lineBehindBars: boolean;
|
|
90
|
+
arrowPoints: any;
|
|
91
|
+
totalWidth: number;
|
|
92
|
+
barWidth: number | undefined;
|
|
93
|
+
labelsExtraHeight: number;
|
|
94
|
+
scrollEventThrottle: number;
|
|
95
|
+
xAxisLabelsVerticalShift: any;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
+
if (ar || !(i in from)) {
|
|
31
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
+
ar[i] = from[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
+
};
|
|
37
|
+
import { useEffect, useState } from 'react';
|
|
38
|
+
import { AxesAndRulesDefaults, BarDefaults } from '../../utils/constants';
|
|
39
|
+
export var useBarAndLineChartsWrapper = function (props) {
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
|
|
41
|
+
var chartType = props.chartType, containerHeight = props.containerHeight, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, stepHeight = props.stepHeight, labelsExtraHeight = props.labelsExtraHeight, yAxisLabelWidth = props.yAxisLabelWidth, horizontal = props.horizontal, rtl = props.rtl, shiftX = props.shiftX, shiftY = props.shiftY, initialSpacing = props.initialSpacing, data = props.data, stackData = props.stackData, secondaryData = props.secondaryData, barWidth = props.barWidth, xAxisThickness = props.xAxisThickness, totalWidth = props.totalWidth, spacing = props.spacing, lineConfig = props.lineConfig, lineConfig2 = props.lineConfig2, maxValue = props.maxValue, lineData = props.lineData, lineData2 = props.lineData2, animatedWidth = props.animatedWidth, lineBehindBars = props.lineBehindBars, points = props.points, points2 = props.points2, arrowPoints = props.arrowPoints, width = props.width, horizSections = props.horizSections, endSpacing = props.endSpacing, horizontalRulesStyle = props.horizontalRulesStyle, noOfSections = props.noOfSections, showFractionalValues = props.showFractionalValues, axesAndRulesProps = props.axesAndRulesProps, yAxisLabelTexts = props.yAxisLabelTexts, yAxisOffset = props.yAxisOffset, rotateYAxisTexts = props.rotateYAxisTexts, pointerConfig = props.pointerConfig, getPointerProps = props.getPointerProps, pointerIndex = props.pointerIndex, pointerX = props.pointerX, pointerY = props.pointerY, scrollEventThrottle = props.scrollEventThrottle, endReachedOffset = props.endReachedOffset, isRTL = props.isRTL;
|
|
42
|
+
var yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop;
|
|
43
|
+
var hideOrigin = (_a = axesAndRulesProps.hideOrigin) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.hideOrigin;
|
|
44
|
+
var yAxisSide = (_b = axesAndRulesProps.yAxisSide) !== null && _b !== void 0 ? _b : AxesAndRulesDefaults.yAxisSide;
|
|
45
|
+
var yAxisLabelContainerStyle = axesAndRulesProps.yAxisLabelContainerStyle;
|
|
46
|
+
var yAxisColor = (_c = axesAndRulesProps.yAxisColor) !== null && _c !== void 0 ? _c : AxesAndRulesDefaults.yAxisColor;
|
|
47
|
+
var yAxisExtraHeight = (_d = axesAndRulesProps.yAxisExtraHeight) !== null && _d !== void 0 ? _d : containerHeight / 20;
|
|
48
|
+
var trimYAxisAtTop = (_e = axesAndRulesProps.trimYAxisAtTop) !== null && _e !== void 0 ? _e : AxesAndRulesDefaults.trimYAxisAtTop;
|
|
49
|
+
var overflowTop = (_f = axesAndRulesProps.overflowTop) !== null && _f !== void 0 ? _f : AxesAndRulesDefaults.overflowTop;
|
|
50
|
+
var yAxisThickness = (_g = axesAndRulesProps.yAxisThickness) !== null && _g !== void 0 ? _g : AxesAndRulesDefaults.yAxisThickness;
|
|
51
|
+
var xAxisColor = (_h = axesAndRulesProps.xAxisColor) !== null && _h !== void 0 ? _h : AxesAndRulesDefaults.xAxisColor;
|
|
52
|
+
var xAxisLength = axesAndRulesProps.xAxisLength;
|
|
53
|
+
var xAxisType = (_j = axesAndRulesProps.xAxisType) !== null && _j !== void 0 ? _j : AxesAndRulesDefaults.xAxisType;
|
|
54
|
+
var xAxisLabelsVerticalShift = (_k = axesAndRulesProps.xAxisLabelsVerticalShift) !== null && _k !== void 0 ? _k : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
|
|
55
|
+
var xAxisLabelsHeight = axesAndRulesProps.xAxisLabelsHeight;
|
|
56
|
+
var xAxisTextNumberOfLines = axesAndRulesProps.xAxisTextNumberOfLines;
|
|
57
|
+
var dashWidth = (_l = axesAndRulesProps.dashWidth) !== null && _l !== void 0 ? _l : AxesAndRulesDefaults.dashWidth;
|
|
58
|
+
var dashGap = (_m = axesAndRulesProps.dashGap) !== null && _m !== void 0 ? _m : AxesAndRulesDefaults.dashGap;
|
|
59
|
+
var backgroundColor = (_o = axesAndRulesProps.backgroundColor) !== null && _o !== void 0 ? _o : AxesAndRulesDefaults.backgroundColor;
|
|
60
|
+
var hideRules = (_p = axesAndRulesProps.hideRules) !== null && _p !== void 0 ? _p : AxesAndRulesDefaults.hideRules;
|
|
61
|
+
var rulesLength = axesAndRulesProps.rulesLength;
|
|
62
|
+
var rulesType = (_q = axesAndRulesProps.rulesType) !== null && _q !== void 0 ? _q : AxesAndRulesDefaults.rulesType;
|
|
63
|
+
var rulesThickness = (_r = axesAndRulesProps.rulesThickness) !== null && _r !== void 0 ? _r : AxesAndRulesDefaults.rulesThickness;
|
|
64
|
+
var rulesColor = (_s = axesAndRulesProps.rulesColor) !== null && _s !== void 0 ? _s : AxesAndRulesDefaults.rulesColor;
|
|
65
|
+
var rulesConfigArray = (_t = axesAndRulesProps.rulesConfigArray) !== null && _t !== void 0 ? _t : AxesAndRulesDefaults.rulesConfigArray;
|
|
66
|
+
var showYAxisIndices = (_u = axesAndRulesProps.showYAxisIndices) !== null && _u !== void 0 ? _u : false;
|
|
67
|
+
var yAxisIndicesHeight = (_v = axesAndRulesProps.yAxisIndicesHeight) !== null && _v !== void 0 ? _v : AxesAndRulesDefaults.yAxisIndicesHeight;
|
|
68
|
+
var yAxisIndicesWidth = (_w = axesAndRulesProps.yAxisIndicesWidth) !== null && _w !== void 0 ? _w : AxesAndRulesDefaults.yAxisIndicesWidth;
|
|
69
|
+
var yAxisIndicesColor = (_x = axesAndRulesProps.yAxisIndicesColor) !== null && _x !== void 0 ? _x : AxesAndRulesDefaults.yAxisIndicesColor;
|
|
70
|
+
var hideYAxisText = (_y = axesAndRulesProps.hideYAxisText) !== null && _y !== void 0 ? _y : AxesAndRulesDefaults.hideYAxisText;
|
|
71
|
+
var yAxisTextNumberOfLines = (_z = axesAndRulesProps.yAxisTextNumberOfLines) !== null && _z !== void 0 ? _z : AxesAndRulesDefaults.yAxisTextNumberOfLines;
|
|
72
|
+
var yAxisLabelPrefix = (_0 = axesAndRulesProps.yAxisLabelPrefix) !== null && _0 !== void 0 ? _0 : '';
|
|
73
|
+
var yAxisLabelSuffix = (_1 = axesAndRulesProps.yAxisLabelSuffix) !== null && _1 !== void 0 ? _1 : '';
|
|
74
|
+
var yAxisTextStyle = axesAndRulesProps.yAxisTextStyle;
|
|
75
|
+
var secondaryYAxis = axesAndRulesProps.secondaryYAxis;
|
|
76
|
+
var stepValue = axesAndRulesProps.stepValue;
|
|
77
|
+
var roundToDigits = axesAndRulesProps.roundToDigits;
|
|
78
|
+
var referenceLinesConfig = axesAndRulesProps.referenceLinesConfig;
|
|
79
|
+
var referenceLinesOverChartContent = (_2 = referenceLinesConfig.referenceLinesOverChartContent) !== null && _2 !== void 0 ? _2 : AxesAndRulesDefaults.referenceLinesOverChartContent;
|
|
80
|
+
var showVerticalLines = (_3 = axesAndRulesProps.showVerticalLines) !== null && _3 !== void 0 ? _3 : AxesAndRulesDefaults.showVerticalLines;
|
|
81
|
+
var verticalLinesThickness = (_4 = axesAndRulesProps.verticalLinesThickness) !== null && _4 !== void 0 ? _4 : AxesAndRulesDefaults.verticalLinesThickness;
|
|
82
|
+
var verticalLinesHeight = axesAndRulesProps.verticalLinesHeight;
|
|
83
|
+
var verticalLinesColor = (_5 = axesAndRulesProps.verticalLinesColor) !== null && _5 !== void 0 ? _5 : AxesAndRulesDefaults.verticalLinesColor;
|
|
84
|
+
var verticalLinesStrokeDashArray = (_6 = axesAndRulesProps.verticalLinesStrokeDashArray) !== null && _6 !== void 0 ? _6 : AxesAndRulesDefaults.verticalLinesStrokeDashArray;
|
|
85
|
+
var verticalLinesShift = (_7 = axesAndRulesProps.verticalLinesShift) !== null && _7 !== void 0 ? _7 : AxesAndRulesDefaults.verticalLinesShift;
|
|
86
|
+
var verticalLinesZIndex = (_8 = axesAndRulesProps.verticalLinesZIndex) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.verticalLinesZIndex;
|
|
87
|
+
var verticalLinesSpacing = (_9 = axesAndRulesProps.verticalLinesSpacing) !== null && _9 !== void 0 ? _9 : AxesAndRulesDefaults.verticalLinesSpacing;
|
|
88
|
+
var verticalLinesUptoDataPoint = (_10 = axesAndRulesProps.verticalLinesUptoDataPoint) !== null && _10 !== void 0 ? _10 : AxesAndRulesDefaults.verticalLinesUptoDataPoint;
|
|
89
|
+
var noOfVerticalLines = axesAndRulesProps.noOfVerticalLines;
|
|
90
|
+
var verticalLinesAr = noOfVerticalLines
|
|
91
|
+
? __spreadArray([], __read(Array(noOfVerticalLines).keys()), false) : __spreadArray([], __read(Array(stackData ? stackData.length : data.length).keys()), false);
|
|
92
|
+
var horizSectionProps = {
|
|
93
|
+
width: width,
|
|
94
|
+
horizSections: horizSections,
|
|
95
|
+
noOfSectionsBelowXAxis: noOfSectionsBelowXAxis,
|
|
96
|
+
totalWidth: totalWidth,
|
|
97
|
+
endSpacing: endSpacing,
|
|
98
|
+
yAxisSide: yAxisSide,
|
|
99
|
+
horizontalRulesStyle: horizontalRulesStyle,
|
|
100
|
+
noOfSections: noOfSections,
|
|
101
|
+
stepHeight: stepHeight,
|
|
102
|
+
yAxisLabelWidth: yAxisLabelWidth,
|
|
103
|
+
yAxisLabelContainerStyle: yAxisLabelContainerStyle,
|
|
104
|
+
yAxisThickness: yAxisThickness,
|
|
105
|
+
yAxisColor: yAxisColor,
|
|
106
|
+
yAxisExtraHeight: yAxisExtraHeight,
|
|
107
|
+
trimYAxisAtTop: trimYAxisAtTop,
|
|
108
|
+
xAxisThickness: xAxisThickness,
|
|
109
|
+
xAxisColor: xAxisColor,
|
|
110
|
+
xAxisLength: xAxisLength,
|
|
111
|
+
xAxisType: xAxisType,
|
|
112
|
+
dashWidth: dashWidth,
|
|
113
|
+
dashGap: dashGap,
|
|
114
|
+
backgroundColor: backgroundColor,
|
|
115
|
+
hideRules: hideRules,
|
|
116
|
+
rulesLength: rulesLength,
|
|
117
|
+
rulesType: rulesType,
|
|
118
|
+
rulesThickness: rulesThickness,
|
|
119
|
+
rulesColor: rulesColor,
|
|
120
|
+
rulesConfigArray: rulesConfigArray,
|
|
121
|
+
spacing: spacing,
|
|
122
|
+
showYAxisIndices: showYAxisIndices,
|
|
123
|
+
yAxisIndicesHeight: yAxisIndicesHeight,
|
|
124
|
+
yAxisIndicesWidth: yAxisIndicesWidth,
|
|
125
|
+
yAxisIndicesColor: yAxisIndicesColor,
|
|
126
|
+
hideOrigin: hideOrigin,
|
|
127
|
+
hideYAxisText: hideYAxisText,
|
|
128
|
+
showFractionalValues: showFractionalValues,
|
|
129
|
+
yAxisTextNumberOfLines: yAxisTextNumberOfLines,
|
|
130
|
+
yAxisLabelPrefix: yAxisLabelPrefix,
|
|
131
|
+
yAxisLabelSuffix: yAxisLabelSuffix,
|
|
132
|
+
yAxisTextStyle: yAxisTextStyle,
|
|
133
|
+
rotateYAxisTexts: rotateYAxisTexts,
|
|
134
|
+
rtl: rtl,
|
|
135
|
+
containerHeight: containerHeight,
|
|
136
|
+
overflowTop: overflowTop,
|
|
137
|
+
maxValue: maxValue,
|
|
138
|
+
referenceLinesConfig: referenceLinesConfig,
|
|
139
|
+
yAxisLabelTexts: yAxisLabelTexts,
|
|
140
|
+
yAxisOffset: yAxisOffset,
|
|
141
|
+
horizontal: horizontal,
|
|
142
|
+
yAxisAtTop: yAxisAtTop,
|
|
143
|
+
stepValue: stepValue,
|
|
144
|
+
roundToDigits: roundToDigits,
|
|
145
|
+
secondaryData: secondaryData,
|
|
146
|
+
secondaryYAxis: secondaryYAxis,
|
|
147
|
+
formatYLabel: axesAndRulesProps.formatYLabel
|
|
148
|
+
};
|
|
149
|
+
var lineInBarChartProps = {
|
|
150
|
+
yAxisLabelWidth: yAxisLabelWidth,
|
|
151
|
+
initialSpacing: initialSpacing,
|
|
152
|
+
spacing: spacing,
|
|
153
|
+
containerHeight: containerHeight,
|
|
154
|
+
lineConfig: lineConfig,
|
|
155
|
+
maxValue: (_11 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue) !== null && _11 !== void 0 ? _11 : maxValue,
|
|
156
|
+
animatedWidth: animatedWidth,
|
|
157
|
+
lineBehindBars: lineBehindBars,
|
|
158
|
+
points: points,
|
|
159
|
+
arrowPoints: arrowPoints,
|
|
160
|
+
data: (lineData === null || lineData === void 0 ? void 0 : lineData.length) ? lineData : stackData !== null && stackData !== void 0 ? stackData : data,
|
|
161
|
+
totalWidth: totalWidth,
|
|
162
|
+
barWidth: barWidth,
|
|
163
|
+
labelsExtraHeight: labelsExtraHeight,
|
|
164
|
+
scrollEventThrottle: scrollEventThrottle,
|
|
165
|
+
xAxisLabelsVerticalShift: xAxisLabelsVerticalShift
|
|
166
|
+
};
|
|
167
|
+
var lineInBarChartProps2 = __assign(__assign({}, lineInBarChartProps), { lineConfig: lineConfig2, points: points2, data: lineData2 });
|
|
168
|
+
var extendedContainerHeight = containerHeight + overflowTop + 10;
|
|
169
|
+
var containerHeightIncludingBelowXAxis = extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
|
|
170
|
+
var verticalLinesProps = {
|
|
171
|
+
verticalLinesAr: verticalLinesAr,
|
|
172
|
+
verticalLinesSpacing: verticalLinesSpacing,
|
|
173
|
+
spacing: (_12 = lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.spacing) !== null && _12 !== void 0 ? _12 : spacing,
|
|
174
|
+
initialSpacing: initialSpacing,
|
|
175
|
+
verticalLinesZIndex: verticalLinesZIndex,
|
|
176
|
+
verticalLinesHeight: verticalLinesHeight,
|
|
177
|
+
verticalLinesThickness: verticalLinesThickness,
|
|
178
|
+
verticalLinesColor: verticalLinesColor,
|
|
179
|
+
verticalLinesStrokeDashArray: verticalLinesStrokeDashArray,
|
|
180
|
+
verticalLinesShift: verticalLinesShift,
|
|
181
|
+
verticalLinesUptoDataPoint: verticalLinesUptoDataPoint,
|
|
182
|
+
xAxisThickness: xAxisThickness,
|
|
183
|
+
labelsExtraHeight: labelsExtraHeight,
|
|
184
|
+
containerHeight: containerHeight,
|
|
185
|
+
data: data,
|
|
186
|
+
stackData: stackData,
|
|
187
|
+
barWidth: barWidth,
|
|
188
|
+
maxValue: maxValue,
|
|
189
|
+
chartType: chartType,
|
|
190
|
+
containerHeightIncludingBelowXAxis: containerHeightIncludingBelowXAxis,
|
|
191
|
+
yAxisLabelWidth: yAxisLabelWidth,
|
|
192
|
+
totalWidth: totalWidth,
|
|
193
|
+
xAxisLabelsVerticalShift: xAxisLabelsVerticalShift
|
|
194
|
+
};
|
|
195
|
+
var actualContainerHeight = containerHeightIncludingBelowXAxis + labelsExtraHeight - 10;
|
|
196
|
+
var actualContainerWidth = (width !== null && width !== void 0 ? width : totalWidth) + yAxisLabelWidth;
|
|
197
|
+
/*******************************************************************************************************************************************/
|
|
198
|
+
/** ************* horizontal chart related calculations *******************/
|
|
199
|
+
/*******************************************************************************************************************************************/
|
|
200
|
+
var containerHeightIncludingXaxisLabels = actualContainerHeight + BarDefaults.labelsWidthForHorizontal;
|
|
201
|
+
var difBwWidthHeight = actualContainerWidth - containerHeightIncludingXaxisLabels;
|
|
202
|
+
var transformForHorizontal = [
|
|
203
|
+
{ rotate: rtl ? '-90deg' : '90deg' },
|
|
204
|
+
{
|
|
205
|
+
translateY: -shiftX + (rtl ? -difBwWidthHeight + 14 : difBwWidthHeight) / 2 - 20
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
translateX: shiftY +
|
|
209
|
+
(rtl
|
|
210
|
+
? (props.width ? -98 - endSpacing : -75 - endSpacing) -
|
|
211
|
+
difBwWidthHeight
|
|
212
|
+
: props.width
|
|
213
|
+
? difBwWidthHeight
|
|
214
|
+
: difBwWidthHeight - 40) /
|
|
215
|
+
2 +
|
|
216
|
+
(yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52)
|
|
217
|
+
}
|
|
218
|
+
];
|
|
219
|
+
var _13 = __read(useState(false), 2), canMomentum = _13[0], setCanMomentum = _13[1];
|
|
220
|
+
var isCloseToEnd = function (_a) {
|
|
221
|
+
var layoutMeasurement = _a.layoutMeasurement, contentOffset = _a.contentOffset, contentSize = _a.contentSize;
|
|
222
|
+
return isRTL
|
|
223
|
+
? contentOffset.x <= initialSpacing
|
|
224
|
+
: layoutMeasurement.width + contentOffset.x >=
|
|
225
|
+
contentSize.width - initialSpacing - endReachedOffset;
|
|
226
|
+
};
|
|
227
|
+
// const isCloseToStart = ({ layoutMeasurement, contentOffset }) => {
|
|
228
|
+
// return layoutMeasurement.width + contentOffset.x <= initialSpacing;
|
|
229
|
+
// };
|
|
230
|
+
var isCloseToStart = function (_a) {
|
|
231
|
+
var layoutMeasurement = _a.layoutMeasurement, contentOffset = _a.contentOffset, contentSize = _a.contentSize;
|
|
232
|
+
return isRTL
|
|
233
|
+
? layoutMeasurement.width + contentOffset.x >=
|
|
234
|
+
contentSize.width - initialSpacing - endReachedOffset
|
|
235
|
+
: contentOffset.x <= initialSpacing;
|
|
236
|
+
};
|
|
237
|
+
useEffect(function () {
|
|
238
|
+
if (pointerConfig && getPointerProps) {
|
|
239
|
+
getPointerProps({ pointerIndex: pointerIndex, pointerX: pointerX, pointerY: pointerY });
|
|
240
|
+
}
|
|
241
|
+
}, [pointerIndex, pointerX, pointerY]);
|
|
242
|
+
return {
|
|
243
|
+
containerHeightIncludingBelowXAxis: containerHeightIncludingBelowXAxis,
|
|
244
|
+
xAxisLabelsVerticalShift: xAxisLabelsVerticalShift,
|
|
245
|
+
trimYAxisAtTop: trimYAxisAtTop,
|
|
246
|
+
yAxisExtraHeight: yAxisExtraHeight,
|
|
247
|
+
overflowTop: overflowTop,
|
|
248
|
+
xAxisLabelsHeight: xAxisLabelsHeight,
|
|
249
|
+
xAxisTextNumberOfLines: xAxisTextNumberOfLines,
|
|
250
|
+
actualContainerWidth: actualContainerWidth,
|
|
251
|
+
transformForHorizontal: transformForHorizontal,
|
|
252
|
+
horizSectionProps: horizSectionProps,
|
|
253
|
+
referenceLinesOverChartContent: referenceLinesOverChartContent,
|
|
254
|
+
setCanMomentum: setCanMomentum,
|
|
255
|
+
isCloseToStart: isCloseToStart,
|
|
256
|
+
isCloseToEnd: isCloseToEnd,
|
|
257
|
+
canMomentum: canMomentum,
|
|
258
|
+
yAxisAtTop: yAxisAtTop,
|
|
259
|
+
yAxisThickness: yAxisThickness,
|
|
260
|
+
yAxisSide: yAxisSide,
|
|
261
|
+
showVerticalLines: showVerticalLines,
|
|
262
|
+
verticalLinesProps: verticalLinesProps,
|
|
263
|
+
lineInBarChartProps: lineInBarChartProps,
|
|
264
|
+
lineInBarChartProps2: lineInBarChartProps2
|
|
265
|
+
};
|
|
266
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type BarAndLineChartsWrapperTypes,
|
|
5
5
|
type horizSectionPropTypes
|
|
6
6
|
} from '../../utils/types'
|
|
7
|
-
import {
|
|
7
|
+
import { type NativeScrollEvent } from 'react-native'
|
|
8
8
|
|
|
9
9
|
export const useBarAndLineChartsWrapper = (
|
|
10
10
|
props: BarAndLineChartsWrapperTypes
|
|
@@ -58,7 +58,8 @@ export const useBarAndLineChartsWrapper = (
|
|
|
58
58
|
pointerY,
|
|
59
59
|
|
|
60
60
|
scrollEventThrottle,
|
|
61
|
-
endReachedOffset
|
|
61
|
+
endReachedOffset,
|
|
62
|
+
isRTL
|
|
62
63
|
} = props
|
|
63
64
|
|
|
64
65
|
const yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop
|
|
@@ -322,7 +323,7 @@ export const useBarAndLineChartsWrapper = (
|
|
|
322
323
|
contentOffset,
|
|
323
324
|
contentSize
|
|
324
325
|
}: NativeScrollEvent): boolean => {
|
|
325
|
-
return
|
|
326
|
+
return isRTL
|
|
326
327
|
? contentOffset.x <= initialSpacing
|
|
327
328
|
: layoutMeasurement.width + contentOffset.x >=
|
|
328
329
|
contentSize.width - initialSpacing - endReachedOffset
|
|
@@ -337,7 +338,7 @@ export const useBarAndLineChartsWrapper = (
|
|
|
337
338
|
contentOffset,
|
|
338
339
|
contentSize
|
|
339
340
|
}: NativeScrollEvent): boolean => {
|
|
340
|
-
return
|
|
341
|
+
return isRTL
|
|
341
342
|
? layoutMeasurement.width + contentOffset.x >=
|
|
342
343
|
contentSize.width - initialSpacing - endReachedOffset
|
|
343
344
|
: contentOffset.x <= initialSpacing
|