gifted-charts-core 0.1.57 → 0.1.59
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/README.md +10 -0
- package/dist/BarChart/index.d.ts +6 -0
- package/dist/BarChart/index.js +110 -93
- package/dist/BarChart/types.d.ts +14 -0
- package/dist/LineChart/LineChartBiColor.js +3 -1
- package/dist/LineChart/index.d.ts +2 -1
- package/dist/LineChart/index.js +251 -219
- package/dist/PieChart/index.d.ts +16 -0
- package/dist/PieChart/index.js +32 -5
- package/dist/PieChart/main.d.ts +2 -2
- package/dist/PieChart/main.js +9 -11
- package/dist/PieChart/types.d.ts +8 -0
- package/dist/components/BarAndLineChartsWrapper/index.js +4 -2
- package/dist/utils/constants.d.ts +5 -0
- package/dist/utils/constants.js +7 -2
- package/dist/utils/types.d.ts +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,3 +2,13 @@ This library contains the common code used by [react-native-gifted-charts](https
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|

|
|
5
|
+
|
|
6
|
+
## Contributors
|
|
7
|
+
|
|
8
|
+
Thanks to these awesome contributors who make gifted-charts possible.
|
|
9
|
+
<br /><br />
|
|
10
|
+
|
|
11
|
+
<a href="https://github.com/Abhinandan-Kushwaha/gifted-charts-core/graphs/contributors">
|
|
12
|
+
<img src="https://contrib.rocks/image?repo=Abhinandan-Kushwaha/gifted-charts-core" />
|
|
13
|
+
</a>
|
|
14
|
+
<br/><br/>
|
package/dist/BarChart/index.d.ts
CHANGED
|
@@ -194,7 +194,13 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
194
194
|
secondaryNegativeStepValue: number;
|
|
195
195
|
secondaryNoOfSectionsBelowXAxis: number;
|
|
196
196
|
barMarginBottom: any;
|
|
197
|
+
highlightEnabled: boolean;
|
|
198
|
+
highlightedBarIndex: number;
|
|
199
|
+
lowlightOpacity: number;
|
|
200
|
+
stackHighlightEnabled: boolean;
|
|
197
201
|
};
|
|
198
202
|
barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes;
|
|
199
203
|
yAxisExtraHeightAtTop: number;
|
|
204
|
+
selectedStackIndex: number;
|
|
205
|
+
setSelectedStackIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
200
206
|
};
|
package/dist/BarChart/index.js
CHANGED
|
@@ -29,16 +29,25 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
29
29
|
import { getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getLineConfigForBarChart, getMaxValue, getMostNegativeValue, getNoOfSections, getXForLineInBar, getYForLineInBar, indexOfFirstNonZeroDigit, maxAndMinUtil, svgPath } from '../utils';
|
|
30
30
|
import { AxesAndRulesDefaults, BarDefaults, chartTypes, defaultLineConfig, defaultPointerConfig } from '../utils/constants';
|
|
31
31
|
export var useBarChart = function (props) {
|
|
32
|
-
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, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58;
|
|
32
|
+
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, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63;
|
|
33
33
|
var heightValue = props.heightValue, widthValue = props.widthValue, opacityValue = props.opacityValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, parentWidth = props.parentWidth, labelsDistanceFromXaxis = props.labelsDistanceFromXaxis, autoShiftLabelsForNegativeStacks = props.autoShiftLabelsForNegativeStacks, focusedBarIndex = props.focusedBarIndex, negativeStepValue = props.negativeStepValue, autoCenterTooltip = props.autoCenterTooltip;
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
34
|
+
var _64 = __read(useState(''), 2), points = _64[0], setPoints = _64[1];
|
|
35
|
+
var _65 = __read(useState(''), 2), points2 = _65[0], setPoints2 = _65[1];
|
|
36
|
+
var _66 = __read(useState(''), 2), arrowPoints = _66[0], setArrowPoints = _66[1];
|
|
37
|
+
var _67 = __read(useState(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1), 2), selectedIndex = _67[0], setSelectedIndex = _67[1];
|
|
38
|
+
var _68 = __read(useState((_a = props.highlightedStackIndex) !== null && _a !== void 0 ? _a : -1), 2), selectedStackIndex = _68[0], setSelectedStackIndex = _68[1];
|
|
39
|
+
var showLine = (_b = props.showLine) !== null && _b !== void 0 ? _b : BarDefaults.showLine;
|
|
39
40
|
useEffect(function () {
|
|
40
41
|
setSelectedIndex(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1);
|
|
41
42
|
}, [focusedBarIndex]);
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
var _a;
|
|
45
|
+
setSelectedStackIndex((_a = props.highlightedStackIndex) !== null && _a !== void 0 ? _a : -1);
|
|
46
|
+
}, [props.highlightedStackIndex]);
|
|
47
|
+
var highlightEnabled = (_c = props.highlightEnabled) !== null && _c !== void 0 ? _c : BarDefaults.highlightEnabled;
|
|
48
|
+
var highlightedBarIndex = (_d = props.highlightedBarIndex) !== null && _d !== void 0 ? _d : selectedIndex;
|
|
49
|
+
var lowlightOpacity = (_e = props.lowlightOpacity) !== null && _e !== void 0 ? _e : BarDefaults.lowlightOpacity;
|
|
50
|
+
var stackHighlightEnabled = (_f = props.stackHighlightEnabled) !== null && _f !== void 0 ? _f : BarDefaults.stackHighlightEnabled;
|
|
42
51
|
var data = useMemo(function () {
|
|
43
52
|
if (!props.data) {
|
|
44
53
|
return [];
|
|
@@ -76,7 +85,7 @@ export var useBarChart = function (props) {
|
|
|
76
85
|
}
|
|
77
86
|
return props.stackData;
|
|
78
87
|
}, [yAxisOffset, props.stackData]);
|
|
79
|
-
var yAxisLabelWidth = (
|
|
88
|
+
var yAxisLabelWidth = (_g = props.yAxisLabelWidth) !== null && _g !== void 0 ? _g : (props.hideYAxisText
|
|
80
89
|
? AxesAndRulesDefaults.yAxisEmptyLabelWidth
|
|
81
90
|
: AxesAndRulesDefaults.yAxisLabelWidth);
|
|
82
91
|
var autoComputedSectionWidth = props.initialSpacing !== undefined
|
|
@@ -86,19 +95,19 @@ export var useBarChart = function (props) {
|
|
|
86
95
|
var defaultBarWidth = adjustToWidth
|
|
87
96
|
? autoComputedBarWidth
|
|
88
97
|
: BarDefaults.barWidth;
|
|
89
|
-
var barWidth = (
|
|
98
|
+
var barWidth = (_h = props.barWidth) !== null && _h !== void 0 ? _h : defaultBarWidth;
|
|
90
99
|
var autoComputedSpacing = autoComputedSectionWidth * 0.4;
|
|
91
|
-
var spacing = (
|
|
92
|
-
var initialSpacing = (
|
|
93
|
-
var endSpacing = (
|
|
94
|
-
var horizontal = (
|
|
95
|
-
var rtl = (
|
|
96
|
-
var yAxisAtTop = (
|
|
97
|
-
var intactTopLabel = (
|
|
100
|
+
var spacing = (_j = props.spacing) !== null && _j !== void 0 ? _j : (adjustToWidth ? autoComputedSpacing : BarDefaults.spacing);
|
|
101
|
+
var initialSpacing = (_k = props.initialSpacing) !== null && _k !== void 0 ? _k : spacing;
|
|
102
|
+
var endSpacing = (_l = props.endSpacing) !== null && _l !== void 0 ? _l : spacing;
|
|
103
|
+
var horizontal = (_m = props.horizontal) !== null && _m !== void 0 ? _m : BarDefaults.horizontal;
|
|
104
|
+
var rtl = (_o = props.rtl) !== null && _o !== void 0 ? _o : BarDefaults.rtl;
|
|
105
|
+
var yAxisAtTop = (_p = props.yAxisAtTop) !== null && _p !== void 0 ? _p : BarDefaults.yAxisAtTop;
|
|
106
|
+
var intactTopLabel = (_q = props.intactTopLabel) !== null && _q !== void 0 ? _q : BarDefaults.intactTopLabel;
|
|
98
107
|
var heightFromProps = horizontal ? props.width : props.height;
|
|
99
108
|
var widthFromProps = horizontal ? props.height : props.width;
|
|
100
|
-
var isAnimated = (
|
|
101
|
-
var animationDuration = (
|
|
109
|
+
var isAnimated = (_r = props.isAnimated) !== null && _r !== void 0 ? _r : BarDefaults.isAnimated;
|
|
110
|
+
var animationDuration = (_s = props.animationDuration) !== null && _s !== void 0 ? _s : BarDefaults.animationDuration;
|
|
102
111
|
// const secondaryData = getSecondaryDataWithOffsetIncluded(
|
|
103
112
|
// props.secondaryData,
|
|
104
113
|
// props.secondaryYAxis
|
|
@@ -116,7 +125,7 @@ export var useBarChart = function (props) {
|
|
|
116
125
|
return props.lineData;
|
|
117
126
|
}, [yAxisOffset, props.lineData, data, stackData]);
|
|
118
127
|
var lineData2 = props.lineData2;
|
|
119
|
-
var lineBehindBars = (
|
|
128
|
+
var lineBehindBars = (_t = props.lineBehindBars) !== null && _t !== void 0 ? _t : BarDefaults.lineBehindBars;
|
|
120
129
|
defaultLineConfig.initialSpacing = initialSpacing;
|
|
121
130
|
defaultLineConfig.endIndex = lineData.length - 1;
|
|
122
131
|
defaultLineConfig.animationDuration = animationDuration;
|
|
@@ -131,12 +140,12 @@ export var useBarChart = function (props) {
|
|
|
131
140
|
? props.stepHeight * noOfSections
|
|
132
141
|
: AxesAndRulesDefaults.containerHeight);
|
|
133
142
|
var horizSections = [{ value: '0' }];
|
|
134
|
-
var stepHeight = (
|
|
135
|
-
var labelWidth = (
|
|
136
|
-
var scrollToEnd = (
|
|
137
|
-
var scrollAnimation = (
|
|
138
|
-
var scrollEventThrottle = (
|
|
139
|
-
var labelsExtraHeight = (
|
|
143
|
+
var stepHeight = (_u = props.stepHeight) !== null && _u !== void 0 ? _u : containerHeight / noOfSections;
|
|
144
|
+
var labelWidth = (_v = props.labelWidth) !== null && _v !== void 0 ? _v : AxesAndRulesDefaults.labelWidth;
|
|
145
|
+
var scrollToEnd = (_w = props.scrollToEnd) !== null && _w !== void 0 ? _w : BarDefaults.scrollToEnd;
|
|
146
|
+
var scrollAnimation = (_x = props.scrollAnimation) !== null && _x !== void 0 ? _x : BarDefaults.scrollAnimation;
|
|
147
|
+
var scrollEventThrottle = (_y = props.scrollEventThrottle) !== null && _y !== void 0 ? _y : BarDefaults.scrollEventThrottle;
|
|
148
|
+
var labelsExtraHeight = (_z = props.labelsExtraHeight) !== null && _z !== void 0 ? _z : AxesAndRulesDefaults.labelsExtraHeight;
|
|
140
149
|
var secondaryMaxItem = 0;
|
|
141
150
|
var secondaryMinItem = 0;
|
|
142
151
|
if (lineConfig.isSecondary) {
|
|
@@ -212,13 +221,13 @@ export var useBarChart = function (props) {
|
|
|
212
221
|
});
|
|
213
222
|
}
|
|
214
223
|
var valuesRange = maxItem - minPositiveItem; // Diff bw largest & smallest +ve values
|
|
215
|
-
var showFractionalValues = (
|
|
216
|
-
var roundToDigits = (
|
|
224
|
+
var showFractionalValues = (_0 = props.showFractionalValues) !== null && _0 !== void 0 ? _0 : valuesRange <= 1;
|
|
225
|
+
var roundToDigits = (_1 = props.roundToDigits) !== null && _1 !== void 0 ? _1 : (showFractionalValues ? indexOfFirstNonZeroDigit(valuesRange) + 1 : 0);
|
|
217
226
|
var maxAndMin = maxAndMinUtil(maxItem, minItem, roundToDigits, showFractionalValues);
|
|
218
227
|
var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxAndMin.maxItem) || 10;
|
|
219
228
|
var secondaryRange = secondaryMaxItem - secondaryMinPositiveItem; // Diff bw largest & smallest +ve values
|
|
220
|
-
var showSecondaryFractionalValues = (
|
|
221
|
-
var secondaryRoundToDigits = (
|
|
229
|
+
var showSecondaryFractionalValues = (_3 = (_2 = props.secondaryYAxis) === null || _2 === void 0 ? void 0 : _2.showFractionalValues) !== null && _3 !== void 0 ? _3 : secondaryRange <= 1;
|
|
230
|
+
var secondaryRoundToDigits = (_5 = (_4 = props.secondaryYAxis) === null || _4 === void 0 ? void 0 : _4.roundToDigits) !== null && _5 !== void 0 ? _5 : (showSecondaryFractionalValues
|
|
222
231
|
? indexOfFirstNonZeroDigit(secondaryRange) + 1
|
|
223
232
|
: 0);
|
|
224
233
|
var secondaryMaxAndMin = maxAndMinUtil(secondaryMaxItem, secondaryMinItem, secondaryRoundToDigits, showSecondaryFractionalValues);
|
|
@@ -228,87 +237,87 @@ export var useBarChart = function (props) {
|
|
|
228
237
|
// secondaryMaxAndMin.maxItem
|
|
229
238
|
// : secondaryMaxAndMin.maxItem
|
|
230
239
|
// : maxValue
|
|
231
|
-
var secondaryMaxValue = (
|
|
240
|
+
var secondaryMaxValue = (_7 = (_6 = props.secondaryYAxis) === null || _6 === void 0 ? void 0 : _6.maxValue) !== null && _7 !== void 0 ? _7 : secondaryMaxAndMin.maxItem;
|
|
232
241
|
var mostNegativeValue = getMostNegativeValue(props.mostNegativeValue, props.negativeStepValue, props.noOfSectionsBelowXAxis, maxAndMin.minItem);
|
|
233
|
-
var stepValue = (
|
|
242
|
+
var stepValue = (_8 = props.stepValue) !== null && _8 !== void 0 ? _8 : maxValue / noOfSections;
|
|
234
243
|
var effectiveNegativeStepValue = negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue;
|
|
235
|
-
var noOfSectionsBelowXAxis = (
|
|
244
|
+
var noOfSectionsBelowXAxis = (_9 = props.noOfSectionsBelowXAxis) !== null && _9 !== void 0 ? _9 : (effectiveNegativeStepValue
|
|
236
245
|
? Math.round(Math.ceil(-mostNegativeValue / effectiveNegativeStepValue))
|
|
237
246
|
: 0);
|
|
238
|
-
var showScrollIndicator = (
|
|
239
|
-
var side = (
|
|
240
|
-
var rotateLabel = (
|
|
241
|
-
var opacity = (
|
|
242
|
-
var isThreeD = (
|
|
243
|
-
var showXAxisIndices = (
|
|
244
|
-
var xAxisIndicesHeight = (
|
|
245
|
-
var xAxisIndicesWidth = (
|
|
246
|
-
var xAxisIndicesColor = (
|
|
247
|
-
var xAxisThickness = (
|
|
248
|
-
var xAxisTextNumberOfLines = (
|
|
249
|
-
var xAxisLabelsVerticalShift = (
|
|
247
|
+
var showScrollIndicator = (_10 = props.showScrollIndicator) !== null && _10 !== void 0 ? _10 : BarDefaults.showScrollIndicator;
|
|
248
|
+
var side = (_11 = props.side) !== null && _11 !== void 0 ? _11 : BarDefaults.side;
|
|
249
|
+
var rotateLabel = (_12 = props.rotateLabel) !== null && _12 !== void 0 ? _12 : AxesAndRulesDefaults.rotateLabel;
|
|
250
|
+
var opacity = (_13 = props.opacity) !== null && _13 !== void 0 ? _13 : BarDefaults.opacity;
|
|
251
|
+
var isThreeD = (_14 = props.isThreeD) !== null && _14 !== void 0 ? _14 : BarDefaults.isThreeD;
|
|
252
|
+
var showXAxisIndices = (_15 = props.showXAxisIndices) !== null && _15 !== void 0 ? _15 : AxesAndRulesDefaults.showXAxisIndices;
|
|
253
|
+
var xAxisIndicesHeight = (_16 = props.xAxisIndicesHeight) !== null && _16 !== void 0 ? _16 : AxesAndRulesDefaults.xAxisIndicesHeight;
|
|
254
|
+
var xAxisIndicesWidth = (_17 = props.xAxisIndicesWidth) !== null && _17 !== void 0 ? _17 : AxesAndRulesDefaults.xAxisIndicesWidth;
|
|
255
|
+
var xAxisIndicesColor = (_18 = props.xAxisIndicesColor) !== null && _18 !== void 0 ? _18 : AxesAndRulesDefaults.xAxisIndicesColor;
|
|
256
|
+
var xAxisThickness = (_19 = props.xAxisThickness) !== null && _19 !== void 0 ? _19 : AxesAndRulesDefaults.xAxisThickness;
|
|
257
|
+
var xAxisTextNumberOfLines = (_20 = props.xAxisTextNumberOfLines) !== null && _20 !== void 0 ? _20 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
|
|
258
|
+
var xAxisLabelsVerticalShift = (_21 = props.xAxisLabelsVerticalShift) !== null && _21 !== void 0 ? _21 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
|
|
250
259
|
var horizontalRulesStyle = props.horizontalRulesStyle;
|
|
251
|
-
var autoShiftLabels = (
|
|
252
|
-
var barBorderColor = (
|
|
260
|
+
var autoShiftLabels = (_22 = props.autoShiftLabels) !== null && _22 !== void 0 ? _22 : false;
|
|
261
|
+
var barBorderColor = (_23 = props.barBorderColor) !== null && _23 !== void 0 ? _23 : BarDefaults.barBorderColor;
|
|
253
262
|
var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
|
|
254
263
|
var axesAndRulesProps = getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, roundToDigits, negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue, secondaryMaxValue, secondaryMinItem, showSecondaryFractionalValues, secondaryRoundToDigits);
|
|
255
|
-
var
|
|
256
|
-
var primary4thQuadrantHeight = noOfSectionsBelowXAxis * ((
|
|
264
|
+
var _69 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepHeight = _69.stepHeight, secondaryStepValue = _69.stepValue, secondaryNegativeStepHeight = _69.negativeStepHeight, secondaryNegativeStepValue = _69.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _69.noOfSectionsBelowXAxis;
|
|
265
|
+
var primary4thQuadrantHeight = noOfSectionsBelowXAxis * ((_24 = props.negativeStepHeight) !== null && _24 !== void 0 ? _24 : stepHeight);
|
|
257
266
|
var secondary4thQuadrantHeight = secondaryNoOfSectionsBelowXAxis * secondaryNegativeStepHeight;
|
|
258
267
|
var containerHeightIncludingBelowXAxis = extendedContainerHeight +
|
|
259
268
|
Math.max(primary4thQuadrantHeight, secondary4thQuadrantHeight);
|
|
260
|
-
var
|
|
261
|
-
var
|
|
262
|
-
var
|
|
263
|
-
var
|
|
264
|
-
var
|
|
265
|
-
var
|
|
269
|
+
var _70 = __read(useState(-1), 2), pointerIndex = _70[0], setPointerIndex = _70[1];
|
|
270
|
+
var _71 = __read(useState(0), 2), pointerX = _71[0], setPointerX = _71[1];
|
|
271
|
+
var _72 = __read(useState(0), 2), pointerY = _72[0], setPointerY = _72[1];
|
|
272
|
+
var _73 = __read(useState(), 2), pointerItem = _73[0], setPointerItem = _73[1];
|
|
273
|
+
var _74 = __read(useState(0), 2), responderStartTime = _74[0], setResponderStartTime = _74[1];
|
|
274
|
+
var _75 = __read(useState(false), 2), responderActive = _75[0], setResponderActive = _75[1];
|
|
266
275
|
var pointerConfig = props.pointerConfig;
|
|
267
|
-
var getPointerProps = (
|
|
268
|
-
var pointerHeight = (
|
|
269
|
-
var pointerWidth = (
|
|
270
|
-
var pointerRadius = (
|
|
271
|
-
var pointerColor = (
|
|
272
|
-
var pointerComponent = (
|
|
276
|
+
var getPointerProps = (_25 = props.getPointerProps) !== null && _25 !== void 0 ? _25 : null;
|
|
277
|
+
var pointerHeight = (_26 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _26 !== void 0 ? _26 : defaultPointerConfig.height;
|
|
278
|
+
var pointerWidth = (_27 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _27 !== void 0 ? _27 : defaultPointerConfig.width;
|
|
279
|
+
var pointerRadius = (_28 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _28 !== void 0 ? _28 : defaultPointerConfig.radius;
|
|
280
|
+
var pointerColor = (_29 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _29 !== void 0 ? _29 : defaultPointerConfig.pointerColor;
|
|
281
|
+
var pointerComponent = (_30 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _30 !== void 0 ? _30 : defaultPointerConfig.pointerComponent;
|
|
273
282
|
var showPointerStrip = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.showPointerStrip) === false
|
|
274
283
|
? false
|
|
275
284
|
: defaultPointerConfig.showPointerStrip;
|
|
276
|
-
var pointerStripHeight = (
|
|
277
|
-
var pointerStripWidth = (
|
|
278
|
-
var pointerStripColor = (
|
|
279
|
-
var pointerStripUptoDataPoint = (
|
|
280
|
-
var pointerLabelComponent = (
|
|
281
|
-
var stripOverPointer = (
|
|
282
|
-
var shiftPointerLabelX = (
|
|
283
|
-
var shiftPointerLabelY = (
|
|
284
|
-
var pointerLabelWidth = (
|
|
285
|
-
var pointerLabelHeight = (
|
|
286
|
-
var autoAdjustPointerLabelPosition = (
|
|
287
|
-
var pointerVanishDelay = (
|
|
288
|
-
var activatePointersOnLongPress = (
|
|
289
|
-
var activatePointersDelay = (
|
|
290
|
-
var initialPointerIndex = (
|
|
291
|
-
var initialPointerAppearDelay = (
|
|
285
|
+
var pointerStripHeight = (_31 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _31 !== void 0 ? _31 : defaultPointerConfig.pointerStripHeight;
|
|
286
|
+
var pointerStripWidth = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.pointerStripWidth;
|
|
287
|
+
var pointerStripColor = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.pointerStripColor;
|
|
288
|
+
var pointerStripUptoDataPoint = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _34 !== void 0 ? _34 : defaultPointerConfig.pointerStripUptoDataPoint;
|
|
289
|
+
var pointerLabelComponent = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _35 !== void 0 ? _35 : defaultPointerConfig.pointerLabelComponent;
|
|
290
|
+
var stripOverPointer = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.stripOverPointer;
|
|
291
|
+
var shiftPointerLabelX = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.shiftPointerLabelX;
|
|
292
|
+
var shiftPointerLabelY = (_38 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _38 !== void 0 ? _38 : defaultPointerConfig.shiftPointerLabelY;
|
|
293
|
+
var pointerLabelWidth = (_39 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _39 !== void 0 ? _39 : defaultPointerConfig.pointerLabelWidth;
|
|
294
|
+
var pointerLabelHeight = (_40 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _40 !== void 0 ? _40 : defaultPointerConfig.pointerLabelHeight;
|
|
295
|
+
var autoAdjustPointerLabelPosition = (_41 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _41 !== void 0 ? _41 : defaultPointerConfig.autoAdjustPointerLabelPosition;
|
|
296
|
+
var pointerVanishDelay = (_42 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _42 !== void 0 ? _42 : defaultPointerConfig.pointerVanishDelay;
|
|
297
|
+
var activatePointersOnLongPress = (_43 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _43 !== void 0 ? _43 : defaultPointerConfig.activatePointersOnLongPress;
|
|
298
|
+
var activatePointersDelay = (_44 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _44 !== void 0 ? _44 : defaultPointerConfig.activatePointersDelay;
|
|
299
|
+
var initialPointerIndex = (_45 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _45 !== void 0 ? _45 : defaultPointerConfig.initialPointerIndex;
|
|
300
|
+
var initialPointerAppearDelay = (_46 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _46 !== void 0 ? _46 : (isAnimated
|
|
292
301
|
? animationDuration
|
|
293
302
|
: defaultPointerConfig.initialPointerAppearDelay);
|
|
294
|
-
var persistPointer = (
|
|
295
|
-
var hidePointer1 = (
|
|
303
|
+
var persistPointer = (_47 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _47 !== void 0 ? _47 : defaultPointerConfig.persistPointer;
|
|
304
|
+
var hidePointer1 = (_48 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _48 !== void 0 ? _48 : defaultPointerConfig.hidePointer1;
|
|
296
305
|
var pointerEvents = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerEvents;
|
|
297
|
-
var stripBehindBars = (
|
|
298
|
-
var disableScroll = (
|
|
306
|
+
var stripBehindBars = (_49 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _49 !== void 0 ? _49 : defaultPointerConfig.stripBehindBars;
|
|
307
|
+
var disableScroll = (_50 = props.disableScroll) !== null && _50 !== void 0 ? _50 : (pointerConfig
|
|
299
308
|
? activatePointersOnLongPress
|
|
300
309
|
? !!responderActive
|
|
301
310
|
: true
|
|
302
311
|
: false);
|
|
303
312
|
var yAxisExtraHeightAtTop = props.trimYAxisAtTop
|
|
304
313
|
? 0
|
|
305
|
-
: (
|
|
314
|
+
: (_51 = props.yAxisExtraHeight) !== null && _51 !== void 0 ? _51 : containerHeight / 20;
|
|
306
315
|
var barInnerComponent = props.barInnerComponent;
|
|
307
316
|
var localYAxisOffset1 = lineConfig.isSecondary
|
|
308
|
-
? (
|
|
317
|
+
? (_53 = (_52 = props.secondaryYAxis) === null || _52 === void 0 ? void 0 : _52.yAxisOffset) !== null && _53 !== void 0 ? _53 : 0
|
|
309
318
|
: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
|
|
310
319
|
var localYAxisOffset2 = lineConfig2.isSecondary
|
|
311
|
-
? (
|
|
320
|
+
? (_55 = (_54 = props.secondaryYAxis) === null || _54 === void 0 ? void 0 : _54.yAxisOffset) !== null && _55 !== void 0 ? _55 : 0
|
|
312
321
|
: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
|
|
313
322
|
useEffect(function () {
|
|
314
323
|
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;
|
|
@@ -424,9 +433,9 @@ export var useBarChart = function (props) {
|
|
|
424
433
|
spacing,
|
|
425
434
|
yAxisLabelWidth,
|
|
426
435
|
lineConfig.showArrow,
|
|
427
|
-
(
|
|
428
|
-
(
|
|
429
|
-
(
|
|
436
|
+
(_56 = lineConfig.arrowConfig) === null || _56 === void 0 ? void 0 : _56.length,
|
|
437
|
+
(_57 = lineConfig.arrowConfig) === null || _57 === void 0 ? void 0 : _57.width,
|
|
438
|
+
(_58 = lineConfig.arrowConfig) === null || _58 === void 0 ? void 0 : _58.showArrowBase
|
|
430
439
|
]);
|
|
431
440
|
useEffect(function () {
|
|
432
441
|
var _a, _b;
|
|
@@ -550,7 +559,11 @@ export var useBarChart = function (props) {
|
|
|
550
559
|
secondaryNegativeStepHeight: secondaryNegativeStepHeight,
|
|
551
560
|
secondaryNegativeStepValue: secondaryNegativeStepValue,
|
|
552
561
|
secondaryNoOfSectionsBelowXAxis: secondaryNoOfSectionsBelowXAxis,
|
|
553
|
-
barMarginBottom: (_y = (_x = item.barMarginBottom) !== null && _x !== void 0 ? _x : props.barMarginBottom) !== null && _y !== void 0 ? _y : 0
|
|
562
|
+
barMarginBottom: (_y = (_x = item.barMarginBottom) !== null && _x !== void 0 ? _x : props.barMarginBottom) !== null && _y !== void 0 ? _y : 0,
|
|
563
|
+
highlightEnabled: highlightEnabled,
|
|
564
|
+
highlightedBarIndex: highlightedBarIndex,
|
|
565
|
+
lowlightOpacity: lowlightOpacity,
|
|
566
|
+
stackHighlightEnabled: stackHighlightEnabled
|
|
554
567
|
};
|
|
555
568
|
};
|
|
556
569
|
var barAndLineChartsWrapperProps = {
|
|
@@ -558,19 +571,19 @@ export var useBarChart = function (props) {
|
|
|
558
571
|
containerHeight: containerHeight,
|
|
559
572
|
noOfSectionsBelowXAxis: noOfSectionsBelowXAxis,
|
|
560
573
|
stepHeight: stepHeight,
|
|
561
|
-
negativeStepHeight: (
|
|
574
|
+
negativeStepHeight: (_59 = props.negativeStepHeight) !== null && _59 !== void 0 ? _59 : stepHeight,
|
|
562
575
|
labelsExtraHeight: labelsExtraHeight,
|
|
563
576
|
yAxisLabelWidth: yAxisLabelWidth,
|
|
564
577
|
horizontal: horizontal,
|
|
565
578
|
rtl: rtl,
|
|
566
|
-
shiftX: (
|
|
567
|
-
shiftY: (
|
|
579
|
+
shiftX: (_60 = props.shiftX) !== null && _60 !== void 0 ? _60 : 0,
|
|
580
|
+
shiftY: (_61 = props.shiftY) !== null && _61 !== void 0 ? _61 : 0,
|
|
568
581
|
yAxisAtTop: yAxisAtTop,
|
|
569
582
|
initialSpacing: initialSpacing,
|
|
570
583
|
data: data,
|
|
571
584
|
stackData: stackData,
|
|
572
585
|
// secondaryData,
|
|
573
|
-
barWidth: (
|
|
586
|
+
barWidth: (_62 = props.barWidth) !== null && _62 !== void 0 ? _62 : defaultBarWidth,
|
|
574
587
|
xAxisThickness: xAxisThickness,
|
|
575
588
|
totalWidth: totalWidth,
|
|
576
589
|
disableScroll: disableScroll,
|
|
@@ -619,9 +632,11 @@ export var useBarChart = function (props) {
|
|
|
619
632
|
pointerY: pointerY,
|
|
620
633
|
onEndReached: props.onEndReached,
|
|
621
634
|
onStartReached: props.onStartReached,
|
|
622
|
-
endReachedOffset: (
|
|
635
|
+
endReachedOffset: (_63 = props.endReachedOffset) !== null && _63 !== void 0 ? _63 : BarDefaults.endReachedOffset,
|
|
623
636
|
onMomentumScrollEnd: props.onMomentumScrollEnd,
|
|
624
|
-
customBackground: props.customBackground
|
|
637
|
+
customBackground: props.customBackground,
|
|
638
|
+
highlightEnabled: highlightEnabled,
|
|
639
|
+
lowlightOpacity: lowlightOpacity
|
|
625
640
|
};
|
|
626
641
|
return {
|
|
627
642
|
lineConfig: lineConfig,
|
|
@@ -731,6 +746,8 @@ export var useBarChart = function (props) {
|
|
|
731
746
|
pointerIndex: pointerIndex,
|
|
732
747
|
getPropsCommonForBarAndStack: getPropsCommonForBarAndStack,
|
|
733
748
|
barAndLineChartsWrapperProps: barAndLineChartsWrapperProps,
|
|
734
|
-
yAxisExtraHeightAtTop: yAxisExtraHeightAtTop
|
|
749
|
+
yAxisExtraHeightAtTop: yAxisExtraHeightAtTop,
|
|
750
|
+
selectedStackIndex: selectedStackIndex,
|
|
751
|
+
setSelectedStackIndex: setSelectedStackIndex
|
|
735
752
|
};
|
|
736
753
|
};
|
package/dist/BarChart/types.d.ts
CHANGED
|
@@ -137,6 +137,12 @@ export interface StackedBarChartPropsType {
|
|
|
137
137
|
secondaryNegativeStepValue: number;
|
|
138
138
|
secondaryNoOfSectionsBelowXAxis: number;
|
|
139
139
|
containerHeightIncludingBelowXAxis: number;
|
|
140
|
+
highlightEnabled: boolean;
|
|
141
|
+
highlightedBarIndex: number;
|
|
142
|
+
lowlightOpacity: number;
|
|
143
|
+
stackHighlightEnabled?: boolean;
|
|
144
|
+
selectedStackIndex: number;
|
|
145
|
+
setSelectedStackIndex: Function;
|
|
140
146
|
}
|
|
141
147
|
export interface StackedBarChartPropsTypeForWeb extends StackedBarChartPropsType {
|
|
142
148
|
onContextMenu?: Function;
|
|
@@ -318,6 +324,11 @@ export interface BarChartPropsType {
|
|
|
318
324
|
focusBarOnPress?: boolean;
|
|
319
325
|
focusedBarConfig?: FocusedBarConfig;
|
|
320
326
|
focusedBarIndex?: number;
|
|
327
|
+
highlightEnabled?: boolean;
|
|
328
|
+
highlightedBarIndex?: number;
|
|
329
|
+
lowlightOpacity?: number;
|
|
330
|
+
stackHighlightEnabled?: boolean;
|
|
331
|
+
highlightedStackIndex?: number;
|
|
321
332
|
adjustToWidth?: boolean;
|
|
322
333
|
parentWidth?: number;
|
|
323
334
|
secondaryXAxis?: XAxisConfig;
|
|
@@ -603,6 +614,9 @@ export interface RenderBarsPropsType {
|
|
|
603
614
|
secondaryNegativeStepHeight: number;
|
|
604
615
|
secondaryNegativeStepValue: number;
|
|
605
616
|
secondaryNoOfSectionsBelowXAxis: number;
|
|
617
|
+
highlightEnabled: boolean;
|
|
618
|
+
highlightedBarIndex: number;
|
|
619
|
+
lowlightOpacity: number;
|
|
606
620
|
}
|
|
607
621
|
export interface RenderBarsPropsTypeForWeb extends RenderBarsPropsType {
|
|
608
622
|
renderTooltipConditions: string[];
|
|
@@ -435,7 +435,9 @@ export var useLineChartBiColor = function (props) {
|
|
|
435
435
|
pointerX: 0,
|
|
436
436
|
pointerY: 0,
|
|
437
437
|
endReachedOffset: (_51 = props.endReachedOffset) !== null && _51 !== void 0 ? _51 : LineDefaults.endReachedOffset,
|
|
438
|
-
extraWidthDueToDataPoint: extraWidthDueToDataPoint
|
|
438
|
+
extraWidthDueToDataPoint: extraWidthDueToDataPoint,
|
|
439
|
+
highlightEnabled: LineDefaults.highlightEnabled,
|
|
440
|
+
lowlightOpacity: LineDefaults.lowlightOpacity
|
|
439
441
|
};
|
|
440
442
|
return {
|
|
441
443
|
toggle: toggle,
|
|
@@ -400,7 +400,7 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
|
|
|
400
400
|
cumulativeSpacing4: number[];
|
|
401
401
|
cumulativeSpacing5: number[];
|
|
402
402
|
cumulativeSpacingSecondary: number[];
|
|
403
|
-
cumulativeSpacingForSet:
|
|
403
|
+
cumulativeSpacingForSet: number[][];
|
|
404
404
|
stripOverDataPoints: boolean | undefined;
|
|
405
405
|
strips: any;
|
|
406
406
|
selectedLineNumber: number;
|
|
@@ -417,4 +417,5 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
|
|
|
417
417
|
renderTooltip4: Function | undefined;
|
|
418
418
|
renderTooltip5: Function | undefined;
|
|
419
419
|
renderTooltipSecondary: Function | undefined;
|
|
420
|
+
pointerItemLocal: any[];
|
|
420
421
|
};
|