gifted-charts-core 0.1.62 → 0.1.64

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.
@@ -5,7 +5,7 @@ interface Animated2dWithGradientPropsType extends BarChartPropsType {
5
5
  item: barDataItemNullSafe;
6
6
  index: number;
7
7
  barHeight: number;
8
- selectedIndex: number;
8
+ selectedIndex: number[];
9
9
  barBackgroundPattern?: () => ReactNode;
10
10
  barInnerComponent?: (item?: stackDataItem | barDataItem, index?: number) => ReactNode;
11
11
  patternId?: string;
@@ -27,7 +27,7 @@ import { getBarFrontColor, getBarWidth } from '../utils';
27
27
  export var getPropsForAnimated2DWithGradient = function (props) {
28
28
  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;
29
29
  var barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, barBorderRadius = props.barBorderRadius, barMarginBottom = props.barMarginBottom, item = props.item, barBorderTopLeftRadius = props.barBorderTopLeftRadius, barBorderTopRightRadius = props.barBorderTopRightRadius, barBorderBottomLeftRadius = props.barBorderBottomLeftRadius, barBorderBottomRightRadius = props.barBorderBottomRightRadius, barWidth = props.barWidth, barInnerComponent = props.barInnerComponent, barStyle = props.barStyle, index = props.index, opacity = props.opacity, barHeight = props.barHeight, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, roundedBottom = props.roundedBottom, cappedBars = props.cappedBars, capRadius = props.capRadius, roundedTop = props.roundedTop, barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, frontColor = props.frontColor, showGradient = props.showGradient, gradientColor = props.gradientColor, selectedIndex = props.selectedIndex, focusBarOnPress = props.focusBarOnPress, focusedBarConfig = props.focusedBarConfig, isThreeD = props.isThreeD, yAxisOffset = props.yAxisOffset;
30
- var isFocused = (focusBarOnPress !== null && focusBarOnPress !== void 0 ? focusBarOnPress : false) && selectedIndex === index;
30
+ var isFocused = (focusBarOnPress !== null && focusBarOnPress !== void 0 ? focusBarOnPress : false) && selectedIndex.includes(index);
31
31
  var itemOrPropsBarBorderRadius = (_b = (_a = item.barBorderRadius) !== null && _a !== void 0 ? _a : barBorderRadius) !== null && _b !== void 0 ? _b : 0;
32
32
  var localBarBorderRadius = (isFocused !== null && isFocused !== void 0 ? isFocused : false)
33
33
  ? (_c = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.borderRadius) !== null && _c !== void 0 ? _c : itemOrPropsBarBorderRadius
@@ -77,8 +77,8 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
77
77
  barBorderColor: import("react-native").ColorValue;
78
78
  barInnerComponent: ((item?: stackDataItem | barDataItem, index?: number) => import("react").ReactNode) | undefined;
79
79
  xAxisTextNumberOfLines: number;
80
- selectedIndex: number;
81
- setSelectedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
80
+ selectedIndex: number[];
81
+ setSelectedIndex: import("react").Dispatch<import("react").SetStateAction<number[]>>;
82
82
  isAnimated: boolean;
83
83
  animationDuration: number;
84
84
  side: string;
@@ -171,8 +171,8 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
171
171
  leftShiftForTooltip: number;
172
172
  autoCenterTooltip: boolean | undefined;
173
173
  initialSpacing: number;
174
- selectedIndex: number;
175
- setSelectedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
174
+ selectedIndex: number[];
175
+ setSelectedIndex: import("react").Dispatch<import("react").SetStateAction<number[]>>;
176
176
  activeOpacity: number;
177
177
  noOfSectionsBelowXAxis: number;
178
178
  leftShiftForLastIndexTooltip: number;
@@ -183,7 +183,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
183
183
  pointerConfig: import("../utils/types").Pointer | undefined;
184
184
  yAxisExtraHeightAtTop: number;
185
185
  yAxisOffset: number;
186
- focusedBarIndex: number | undefined;
186
+ focusedBarIndex: number | number[] | undefined;
187
187
  stepHeight: number;
188
188
  stepValue: number;
189
189
  negativeStepHeight: number;
@@ -197,7 +197,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
197
197
  secondaryNoOfSectionsBelowXAxis: number;
198
198
  barMarginBottom: any;
199
199
  highlightEnabled: boolean;
200
- highlightedBarIndex: number;
200
+ highlightedBarIndex: number | number[];
201
201
  lowlightOpacity: number;
202
202
  stackHighlightEnabled: boolean;
203
203
  };
@@ -29,16 +29,24 @@ 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, _59, _60, _61, _62, _63, _64;
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, _64, _65, _66, _67, _68;
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 _65 = __read(useState(''), 2), points = _65[0], setPoints = _65[1];
35
- var _66 = __read(useState(''), 2), points2 = _66[0], setPoints2 = _66[1];
36
- var _67 = __read(useState(''), 2), arrowPoints = _67[0], setArrowPoints = _67[1];
37
- var _68 = __read(useState(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1), 2), selectedIndex = _68[0], setSelectedIndex = _68[1];
38
- var _69 = __read(useState((_a = props.highlightedStackIndex) !== null && _a !== void 0 ? _a : -1), 2), selectedStackIndex = _69[0], setSelectedStackIndex = _69[1];
34
+ var _69 = __read(useState(''), 2), points = _69[0], setPoints = _69[1];
35
+ var _70 = __read(useState(''), 2), points2 = _70[0], setPoints2 = _70[1];
36
+ var _71 = __read(useState(''), 2), arrowPoints = _71[0], setArrowPoints = _71[1];
37
+ var _72 = __read(useState(function () {
38
+ if (Array.isArray(focusedBarIndex)) {
39
+ return focusedBarIndex;
40
+ }
41
+ return [focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1];
42
+ }), 2), selectedIndex = _72[0], setSelectedIndex = _72[1];
43
+ var _73 = __read(useState((_a = props.highlightedStackIndex) !== null && _a !== void 0 ? _a : -1), 2), selectedStackIndex = _73[0], setSelectedStackIndex = _73[1];
39
44
  var showLine = (_b = props.showLine) !== null && _b !== void 0 ? _b : BarDefaults.showLine;
40
45
  useEffect(function () {
41
- setSelectedIndex(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1);
46
+ var newIndex = Array.isArray(focusedBarIndex)
47
+ ? focusedBarIndex
48
+ : [focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1];
49
+ setSelectedIndex(newIndex);
42
50
  }, [focusedBarIndex]);
43
51
  useEffect(function () {
44
52
  var _a;
@@ -85,29 +93,31 @@ export var useBarChart = function (props) {
85
93
  }
86
94
  return props.stackData;
87
95
  }, [yAxisOffset, props.stackData]);
88
- var yAxisLabelWidth = (_g = props.yAxisLabelWidth) !== null && _g !== void 0 ? _g : (props.hideYAxisText
96
+ // adjustToWidth should work for data or stacked data
97
+ var dataLength = (_k = (_h = (_g = props.data) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : (_j = props.stackData) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0;
98
+ var yAxisLabelWidth = (_l = props.yAxisLabelWidth) !== null && _l !== void 0 ? _l : (props.hideYAxisText
89
99
  ? AxesAndRulesDefaults.yAxisEmptyLabelWidth
90
100
  : AxesAndRulesDefaults.yAxisLabelWidth);
91
101
  var autoComputedSectionWidth = props.initialSpacing !== undefined
92
- ? (parentWidth - yAxisLabelWidth) / data.length - props.initialSpacing
93
- : (parentWidth - yAxisLabelWidth) / (data.length + 0.5);
102
+ ? (parentWidth - yAxisLabelWidth) / dataLength - props.initialSpacing
103
+ : (parentWidth - yAxisLabelWidth) / (dataLength + 0.5);
94
104
  var autoComputedBarWidth = autoComputedSectionWidth * 0.6;
95
105
  var defaultBarWidth = adjustToWidth
96
106
  ? autoComputedBarWidth
97
107
  : BarDefaults.barWidth;
98
- var barWidth = (_h = props.barWidth) !== null && _h !== void 0 ? _h : defaultBarWidth;
108
+ var barWidth = (_m = props.barWidth) !== null && _m !== void 0 ? _m : defaultBarWidth;
99
109
  var autoComputedSpacing = autoComputedSectionWidth * 0.4;
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;
110
+ var spacing = (_o = props.spacing) !== null && _o !== void 0 ? _o : (adjustToWidth ? autoComputedSpacing : BarDefaults.spacing);
111
+ var initialSpacing = (_p = props.initialSpacing) !== null && _p !== void 0 ? _p : spacing;
112
+ var endSpacing = (_q = props.endSpacing) !== null && _q !== void 0 ? _q : spacing;
113
+ var horizontal = (_r = props.horizontal) !== null && _r !== void 0 ? _r : BarDefaults.horizontal;
114
+ var rtl = (_s = props.rtl) !== null && _s !== void 0 ? _s : BarDefaults.rtl;
115
+ var yAxisAtTop = (_t = props.yAxisAtTop) !== null && _t !== void 0 ? _t : BarDefaults.yAxisAtTop;
116
+ var intactTopLabel = (_u = props.intactTopLabel) !== null && _u !== void 0 ? _u : BarDefaults.intactTopLabel;
107
117
  var heightFromProps = horizontal ? props.width : props.height;
108
118
  var widthFromProps = horizontal ? props.height : props.width;
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;
119
+ var isAnimated = (_v = props.isAnimated) !== null && _v !== void 0 ? _v : BarDefaults.isAnimated;
120
+ var animationDuration = (_w = props.animationDuration) !== null && _w !== void 0 ? _w : BarDefaults.animationDuration;
111
121
  // const secondaryData = getSecondaryDataWithOffsetIncluded(
112
122
  // props.secondaryData,
113
123
  // props.secondaryYAxis
@@ -125,7 +135,7 @@ export var useBarChart = function (props) {
125
135
  return props.lineData;
126
136
  }, [yAxisOffset, props.lineData, data, stackData]);
127
137
  var lineData2 = props.lineData2;
128
- var lineBehindBars = (_t = props.lineBehindBars) !== null && _t !== void 0 ? _t : BarDefaults.lineBehindBars;
138
+ var lineBehindBars = (_x = props.lineBehindBars) !== null && _x !== void 0 ? _x : BarDefaults.lineBehindBars;
129
139
  defaultLineConfig.initialSpacing = initialSpacing;
130
140
  defaultLineConfig.endIndex = lineData.length - 1;
131
141
  defaultLineConfig.animationDuration = animationDuration;
@@ -140,12 +150,12 @@ export var useBarChart = function (props) {
140
150
  ? props.stepHeight * noOfSections
141
151
  : AxesAndRulesDefaults.containerHeight);
142
152
  var horizSections = [{ value: '0' }];
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;
153
+ var stepHeight = (_y = props.stepHeight) !== null && _y !== void 0 ? _y : containerHeight / noOfSections;
154
+ var labelWidth = (_z = props.labelWidth) !== null && _z !== void 0 ? _z : AxesAndRulesDefaults.labelWidth;
155
+ var scrollToEnd = (_0 = props.scrollToEnd) !== null && _0 !== void 0 ? _0 : BarDefaults.scrollToEnd;
156
+ var scrollAnimation = (_1 = props.scrollAnimation) !== null && _1 !== void 0 ? _1 : BarDefaults.scrollAnimation;
157
+ var scrollEventThrottle = (_2 = props.scrollEventThrottle) !== null && _2 !== void 0 ? _2 : BarDefaults.scrollEventThrottle;
158
+ var labelsExtraHeight = (_3 = props.labelsExtraHeight) !== null && _3 !== void 0 ? _3 : AxesAndRulesDefaults.labelsExtraHeight;
149
159
  var secondaryMaxItem = 0;
150
160
  var secondaryMinItem = 0;
151
161
  if (lineConfig.isSecondary) {
@@ -190,7 +200,7 @@ export var useBarChart = function (props) {
190
200
  }
191
201
  totalWidth +=
192
202
  ((_b = (_a = stackItem.stacks[0].barWidth) !== null && _a !== void 0 ? _a : props.barWidth) !== null && _b !== void 0 ? _b : defaultBarWidth) +
193
- (index === data.length - 1 ? 0 : (_c = stackItem.spacing) !== null && _c !== void 0 ? _c : spacing);
203
+ (index === dataLength - 1 ? 0 : (_c = stackItem.spacing) !== null && _c !== void 0 ? _c : spacing);
194
204
  });
195
205
  }
196
206
  else {
@@ -217,17 +227,17 @@ export var useBarChart = function (props) {
217
227
  }
218
228
  totalWidth +=
219
229
  ((_b = (_a = item.barWidth) !== null && _a !== void 0 ? _a : props.barWidth) !== null && _b !== void 0 ? _b : defaultBarWidth) +
220
- (index === data.length - 1 ? spacing : (_c = item.spacing) !== null && _c !== void 0 ? _c : spacing);
230
+ (index === dataLength - 1 ? spacing : (_c = item.spacing) !== null && _c !== void 0 ? _c : spacing);
221
231
  });
222
232
  }
223
233
  var valuesRange = maxItem - minPositiveItem; // Diff bw largest & smallest +ve values
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);
234
+ var showFractionalValues = (_4 = props.showFractionalValues) !== null && _4 !== void 0 ? _4 : valuesRange <= 1;
235
+ var roundToDigits = (_5 = props.roundToDigits) !== null && _5 !== void 0 ? _5 : (showFractionalValues ? indexOfFirstNonZeroDigit(valuesRange) + 1 : 0);
226
236
  var maxAndMin = maxAndMinUtil(maxItem, minItem, roundToDigits, showFractionalValues);
227
237
  var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxAndMin.maxItem) || 10;
228
238
  var secondaryRange = secondaryMaxItem - secondaryMinPositiveItem; // Diff bw largest & smallest +ve values
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
239
+ var showSecondaryFractionalValues = (_7 = (_6 = props.secondaryYAxis) === null || _6 === void 0 ? void 0 : _6.showFractionalValues) !== null && _7 !== void 0 ? _7 : secondaryRange <= 1;
240
+ var secondaryRoundToDigits = (_9 = (_8 = props.secondaryYAxis) === null || _8 === void 0 ? void 0 : _8.roundToDigits) !== null && _9 !== void 0 ? _9 : (showSecondaryFractionalValues
231
241
  ? indexOfFirstNonZeroDigit(secondaryRange) + 1
232
242
  : 0);
233
243
  var secondaryMaxAndMin = maxAndMinUtil(secondaryMaxItem, secondaryMinItem, secondaryRoundToDigits, showSecondaryFractionalValues);
@@ -237,88 +247,88 @@ export var useBarChart = function (props) {
237
247
  // secondaryMaxAndMin.maxItem
238
248
  // : secondaryMaxAndMin.maxItem
239
249
  // : maxValue
240
- var secondaryMaxValue = (_7 = (_6 = props.secondaryYAxis) === null || _6 === void 0 ? void 0 : _6.maxValue) !== null && _7 !== void 0 ? _7 : secondaryMaxAndMin.maxItem;
250
+ var secondaryMaxValue = (_11 = (_10 = props.secondaryYAxis) === null || _10 === void 0 ? void 0 : _10.maxValue) !== null && _11 !== void 0 ? _11 : secondaryMaxAndMin.maxItem;
241
251
  var mostNegativeValue = getMostNegativeValue(props.mostNegativeValue, props.negativeStepValue, props.noOfSectionsBelowXAxis, maxAndMin.minItem);
242
- var stepValue = (_8 = props.stepValue) !== null && _8 !== void 0 ? _8 : maxValue / noOfSections;
252
+ var stepValue = (_12 = props.stepValue) !== null && _12 !== void 0 ? _12 : maxValue / noOfSections;
243
253
  var effectiveNegativeStepValue = negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue;
244
- var noOfSectionsBelowXAxis = (_9 = props.noOfSectionsBelowXAxis) !== null && _9 !== void 0 ? _9 : (effectiveNegativeStepValue
254
+ var noOfSectionsBelowXAxis = (_13 = props.noOfSectionsBelowXAxis) !== null && _13 !== void 0 ? _13 : (effectiveNegativeStepValue
245
255
  ? Math.round(Math.ceil(-mostNegativeValue / effectiveNegativeStepValue))
246
256
  : 0);
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;
259
- var xAxisLabelsAtBottom = (_22 = props.xAxisLabelsAtBottom) !== null && _22 !== void 0 ? _22 : false;
257
+ var showScrollIndicator = (_14 = props.showScrollIndicator) !== null && _14 !== void 0 ? _14 : BarDefaults.showScrollIndicator;
258
+ var side = (_15 = props.side) !== null && _15 !== void 0 ? _15 : BarDefaults.side;
259
+ var rotateLabel = (_16 = props.rotateLabel) !== null && _16 !== void 0 ? _16 : AxesAndRulesDefaults.rotateLabel;
260
+ var opacity = (_17 = props.opacity) !== null && _17 !== void 0 ? _17 : BarDefaults.opacity;
261
+ var isThreeD = (_18 = props.isThreeD) !== null && _18 !== void 0 ? _18 : BarDefaults.isThreeD;
262
+ var showXAxisIndices = (_19 = props.showXAxisIndices) !== null && _19 !== void 0 ? _19 : AxesAndRulesDefaults.showXAxisIndices;
263
+ var xAxisIndicesHeight = (_20 = props.xAxisIndicesHeight) !== null && _20 !== void 0 ? _20 : AxesAndRulesDefaults.xAxisIndicesHeight;
264
+ var xAxisIndicesWidth = (_21 = props.xAxisIndicesWidth) !== null && _21 !== void 0 ? _21 : AxesAndRulesDefaults.xAxisIndicesWidth;
265
+ var xAxisIndicesColor = (_22 = props.xAxisIndicesColor) !== null && _22 !== void 0 ? _22 : AxesAndRulesDefaults.xAxisIndicesColor;
266
+ var xAxisThickness = (_23 = props.xAxisThickness) !== null && _23 !== void 0 ? _23 : AxesAndRulesDefaults.xAxisThickness;
267
+ var xAxisTextNumberOfLines = (_24 = props.xAxisTextNumberOfLines) !== null && _24 !== void 0 ? _24 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
268
+ var xAxisLabelsVerticalShift = (_25 = props.xAxisLabelsVerticalShift) !== null && _25 !== void 0 ? _25 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
269
+ var xAxisLabelsAtBottom = (_26 = props.xAxisLabelsAtBottom) !== null && _26 !== void 0 ? _26 : false;
260
270
  var horizontalRulesStyle = props.horizontalRulesStyle;
261
- var autoShiftLabels = (_23 = props.autoShiftLabels) !== null && _23 !== void 0 ? _23 : false;
262
- var barBorderColor = (_24 = props.barBorderColor) !== null && _24 !== void 0 ? _24 : BarDefaults.barBorderColor;
271
+ var autoShiftLabels = (_27 = props.autoShiftLabels) !== null && _27 !== void 0 ? _27 : false;
272
+ var barBorderColor = (_28 = props.barBorderColor) !== null && _28 !== void 0 ? _28 : BarDefaults.barBorderColor;
263
273
  var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
264
274
  var axesAndRulesProps = getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, roundToDigits, negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue, secondaryMaxValue, secondaryMinItem, showSecondaryFractionalValues, secondaryRoundToDigits);
265
- var _70 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepHeight = _70.stepHeight, secondaryStepValue = _70.stepValue, secondaryNegativeStepHeight = _70.negativeStepHeight, secondaryNegativeStepValue = _70.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _70.noOfSectionsBelowXAxis;
266
- var primary4thQuadrantHeight = noOfSectionsBelowXAxis * ((_25 = props.negativeStepHeight) !== null && _25 !== void 0 ? _25 : stepHeight);
275
+ var _74 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepHeight = _74.stepHeight, secondaryStepValue = _74.stepValue, secondaryNegativeStepHeight = _74.negativeStepHeight, secondaryNegativeStepValue = _74.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _74.noOfSectionsBelowXAxis;
276
+ var primary4thQuadrantHeight = noOfSectionsBelowXAxis * ((_29 = props.negativeStepHeight) !== null && _29 !== void 0 ? _29 : stepHeight);
267
277
  var secondary4thQuadrantHeight = secondaryNoOfSectionsBelowXAxis * secondaryNegativeStepHeight;
268
278
  var fourthQuadrantHeight = Math.max(primary4thQuadrantHeight, secondary4thQuadrantHeight);
269
279
  var containerHeightIncludingBelowXAxis = extendedContainerHeight + fourthQuadrantHeight;
270
- var _71 = __read(useState(-1), 2), pointerIndex = _71[0], setPointerIndex = _71[1];
271
- var _72 = __read(useState(0), 2), pointerX = _72[0], setPointerX = _72[1];
272
- var _73 = __read(useState(0), 2), pointerY = _73[0], setPointerY = _73[1];
273
- var _74 = __read(useState(), 2), pointerItem = _74[0], setPointerItem = _74[1];
274
- var _75 = __read(useState(0), 2), responderStartTime = _75[0], setResponderStartTime = _75[1];
275
- var _76 = __read(useState(false), 2), responderActive = _76[0], setResponderActive = _76[1];
280
+ var _75 = __read(useState(-1), 2), pointerIndex = _75[0], setPointerIndex = _75[1];
281
+ var _76 = __read(useState(0), 2), pointerX = _76[0], setPointerX = _76[1];
282
+ var _77 = __read(useState(0), 2), pointerY = _77[0], setPointerY = _77[1];
283
+ var _78 = __read(useState(), 2), pointerItem = _78[0], setPointerItem = _78[1];
284
+ var _79 = __read(useState(0), 2), responderStartTime = _79[0], setResponderStartTime = _79[1];
285
+ var _80 = __read(useState(false), 2), responderActive = _80[0], setResponderActive = _80[1];
276
286
  var pointerConfig = props.pointerConfig;
277
- var getPointerProps = (_26 = props.getPointerProps) !== null && _26 !== void 0 ? _26 : null;
278
- var pointerHeight = (_27 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _27 !== void 0 ? _27 : defaultPointerConfig.height;
279
- var pointerWidth = (_28 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _28 !== void 0 ? _28 : defaultPointerConfig.width;
280
- var pointerRadius = (_29 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _29 !== void 0 ? _29 : defaultPointerConfig.radius;
281
- var pointerColor = (_30 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _30 !== void 0 ? _30 : defaultPointerConfig.pointerColor;
282
- var pointerComponent = (_31 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _31 !== void 0 ? _31 : defaultPointerConfig.pointerComponent;
287
+ var getPointerProps = (_30 = props.getPointerProps) !== null && _30 !== void 0 ? _30 : null;
288
+ var pointerHeight = (_31 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _31 !== void 0 ? _31 : defaultPointerConfig.height;
289
+ var pointerWidth = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.width;
290
+ var pointerRadius = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.radius;
291
+ var pointerColor = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _34 !== void 0 ? _34 : defaultPointerConfig.pointerColor;
292
+ var pointerComponent = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _35 !== void 0 ? _35 : defaultPointerConfig.pointerComponent;
283
293
  var showPointerStrip = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.showPointerStrip) === false
284
294
  ? false
285
295
  : defaultPointerConfig.showPointerStrip;
286
- var pointerStripHeight = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.pointerStripHeight;
287
- var pointerStripWidth = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.pointerStripWidth;
288
- var pointerStripColor = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _34 !== void 0 ? _34 : defaultPointerConfig.pointerStripColor;
289
- var pointerStripUptoDataPoint = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _35 !== void 0 ? _35 : defaultPointerConfig.pointerStripUptoDataPoint;
290
- var pointerLabelComponent = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.pointerLabelComponent;
291
- var stripOverPointer = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.stripOverPointer;
292
- var shiftPointerLabelX = (_38 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _38 !== void 0 ? _38 : defaultPointerConfig.shiftPointerLabelX;
293
- var shiftPointerLabelY = (_39 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _39 !== void 0 ? _39 : defaultPointerConfig.shiftPointerLabelY;
294
- var pointerLabelWidth = (_40 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _40 !== void 0 ? _40 : defaultPointerConfig.pointerLabelWidth;
295
- var pointerLabelHeight = (_41 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _41 !== void 0 ? _41 : defaultPointerConfig.pointerLabelHeight;
296
- var autoAdjustPointerLabelPosition = (_42 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _42 !== void 0 ? _42 : defaultPointerConfig.autoAdjustPointerLabelPosition;
297
- var pointerVanishDelay = (_43 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _43 !== void 0 ? _43 : defaultPointerConfig.pointerVanishDelay;
298
- var activatePointersOnLongPress = (_44 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _44 !== void 0 ? _44 : defaultPointerConfig.activatePointersOnLongPress;
299
- var activatePointersDelay = (_45 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _45 !== void 0 ? _45 : defaultPointerConfig.activatePointersDelay;
300
- var initialPointerIndex = (_46 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _46 !== void 0 ? _46 : defaultPointerConfig.initialPointerIndex;
301
- var initialPointerAppearDelay = (_47 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _47 !== void 0 ? _47 : (isAnimated
296
+ var pointerStripHeight = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.pointerStripHeight;
297
+ var pointerStripWidth = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.pointerStripWidth;
298
+ var pointerStripColor = (_38 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _38 !== void 0 ? _38 : defaultPointerConfig.pointerStripColor;
299
+ var pointerStripUptoDataPoint = (_39 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _39 !== void 0 ? _39 : defaultPointerConfig.pointerStripUptoDataPoint;
300
+ var pointerLabelComponent = (_40 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _40 !== void 0 ? _40 : defaultPointerConfig.pointerLabelComponent;
301
+ var stripOverPointer = (_41 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _41 !== void 0 ? _41 : defaultPointerConfig.stripOverPointer;
302
+ var shiftPointerLabelX = (_42 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _42 !== void 0 ? _42 : defaultPointerConfig.shiftPointerLabelX;
303
+ var shiftPointerLabelY = (_43 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _43 !== void 0 ? _43 : defaultPointerConfig.shiftPointerLabelY;
304
+ var pointerLabelWidth = (_44 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _44 !== void 0 ? _44 : defaultPointerConfig.pointerLabelWidth;
305
+ var pointerLabelHeight = (_45 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _45 !== void 0 ? _45 : defaultPointerConfig.pointerLabelHeight;
306
+ var autoAdjustPointerLabelPosition = (_46 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _46 !== void 0 ? _46 : defaultPointerConfig.autoAdjustPointerLabelPosition;
307
+ var pointerVanishDelay = (_47 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _47 !== void 0 ? _47 : defaultPointerConfig.pointerVanishDelay;
308
+ var activatePointersOnLongPress = (_48 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _48 !== void 0 ? _48 : defaultPointerConfig.activatePointersOnLongPress;
309
+ var activatePointersDelay = (_49 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _49 !== void 0 ? _49 : defaultPointerConfig.activatePointersDelay;
310
+ var initialPointerIndex = (_50 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _50 !== void 0 ? _50 : defaultPointerConfig.initialPointerIndex;
311
+ var initialPointerAppearDelay = (_51 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _51 !== void 0 ? _51 : (isAnimated
302
312
  ? animationDuration
303
313
  : defaultPointerConfig.initialPointerAppearDelay);
304
- var persistPointer = (_48 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _48 !== void 0 ? _48 : defaultPointerConfig.persistPointer;
305
- var hidePointer1 = (_49 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _49 !== void 0 ? _49 : defaultPointerConfig.hidePointer1;
314
+ var persistPointer = (_52 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _52 !== void 0 ? _52 : defaultPointerConfig.persistPointer;
315
+ var hidePointer1 = (_53 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _53 !== void 0 ? _53 : defaultPointerConfig.hidePointer1;
306
316
  var pointerEvents = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerEvents;
307
- var stripBehindBars = (_50 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _50 !== void 0 ? _50 : defaultPointerConfig.stripBehindBars;
308
- var disableScroll = (_51 = props.disableScroll) !== null && _51 !== void 0 ? _51 : (pointerConfig
317
+ var stripBehindBars = (_54 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _54 !== void 0 ? _54 : defaultPointerConfig.stripBehindBars;
318
+ var disableScroll = (_55 = props.disableScroll) !== null && _55 !== void 0 ? _55 : (pointerConfig
309
319
  ? activatePointersOnLongPress
310
320
  ? !!responderActive
311
321
  : true
312
322
  : false);
313
323
  var yAxisExtraHeightAtTop = props.trimYAxisAtTop
314
324
  ? 0
315
- : (_52 = props.yAxisExtraHeight) !== null && _52 !== void 0 ? _52 : containerHeight / 20;
325
+ : (_56 = props.yAxisExtraHeight) !== null && _56 !== void 0 ? _56 : containerHeight / 20;
316
326
  var barInnerComponent = props.barInnerComponent;
317
327
  var localYAxisOffset1 = lineConfig.isSecondary
318
- ? (_54 = (_53 = props.secondaryYAxis) === null || _53 === void 0 ? void 0 : _53.yAxisOffset) !== null && _54 !== void 0 ? _54 : 0
328
+ ? (_58 = (_57 = props.secondaryYAxis) === null || _57 === void 0 ? void 0 : _57.yAxisOffset) !== null && _58 !== void 0 ? _58 : 0
319
329
  : yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
320
330
  var localYAxisOffset2 = lineConfig2.isSecondary
321
- ? (_56 = (_55 = props.secondaryYAxis) === null || _55 === void 0 ? void 0 : _55.yAxisOffset) !== null && _56 !== void 0 ? _56 : 0
331
+ ? (_60 = (_59 = props.secondaryYAxis) === null || _59 === void 0 ? void 0 : _59.yAxisOffset) !== null && _60 !== void 0 ? _60 : 0
322
332
  : yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
323
333
  useEffect(function () {
324
334
  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;
@@ -434,9 +444,9 @@ export var useBarChart = function (props) {
434
444
  spacing,
435
445
  yAxisLabelWidth,
436
446
  lineConfig.showArrow,
437
- (_57 = lineConfig.arrowConfig) === null || _57 === void 0 ? void 0 : _57.length,
438
- (_58 = lineConfig.arrowConfig) === null || _58 === void 0 ? void 0 : _58.width,
439
- (_59 = lineConfig.arrowConfig) === null || _59 === void 0 ? void 0 : _59.showArrowBase
447
+ (_61 = lineConfig.arrowConfig) === null || _61 === void 0 ? void 0 : _61.length,
448
+ (_62 = lineConfig.arrowConfig) === null || _62 === void 0 ? void 0 : _62.width,
449
+ (_63 = lineConfig.arrowConfig) === null || _63 === void 0 ? void 0 : _63.showArrowBase
440
450
  ]);
441
451
  useEffect(function () {
442
452
  var _a, _b;
@@ -573,19 +583,19 @@ export var useBarChart = function (props) {
573
583
  containerHeight: containerHeight,
574
584
  noOfSectionsBelowXAxis: noOfSectionsBelowXAxis,
575
585
  stepHeight: stepHeight,
576
- negativeStepHeight: (_60 = props.negativeStepHeight) !== null && _60 !== void 0 ? _60 : stepHeight,
586
+ negativeStepHeight: (_64 = props.negativeStepHeight) !== null && _64 !== void 0 ? _64 : stepHeight,
577
587
  labelsExtraHeight: labelsExtraHeight,
578
588
  yAxisLabelWidth: yAxisLabelWidth,
579
589
  horizontal: horizontal,
580
590
  rtl: rtl,
581
- shiftX: (_61 = props.shiftX) !== null && _61 !== void 0 ? _61 : 0,
582
- shiftY: (_62 = props.shiftY) !== null && _62 !== void 0 ? _62 : 0,
591
+ shiftX: (_65 = props.shiftX) !== null && _65 !== void 0 ? _65 : 0,
592
+ shiftY: (_66 = props.shiftY) !== null && _66 !== void 0 ? _66 : 0,
583
593
  yAxisAtTop: yAxisAtTop,
584
594
  initialSpacing: initialSpacing,
585
595
  data: data,
586
596
  stackData: stackData,
587
597
  // secondaryData,
588
- barWidth: (_63 = props.barWidth) !== null && _63 !== void 0 ? _63 : defaultBarWidth,
598
+ barWidth: (_67 = props.barWidth) !== null && _67 !== void 0 ? _67 : defaultBarWidth,
589
599
  xAxisThickness: xAxisThickness,
590
600
  totalWidth: totalWidth,
591
601
  disableScroll: disableScroll,
@@ -634,7 +644,7 @@ export var useBarChart = function (props) {
634
644
  pointerY: pointerY,
635
645
  onEndReached: props.onEndReached,
636
646
  onStartReached: props.onStartReached,
637
- endReachedOffset: (_64 = props.endReachedOffset) !== null && _64 !== void 0 ? _64 : BarDefaults.endReachedOffset,
647
+ endReachedOffset: (_68 = props.endReachedOffset) !== null && _68 !== void 0 ? _68 : BarDefaults.endReachedOffset,
638
648
  onMomentumScrollEnd: props.onMomentumScrollEnd,
639
649
  customBackground: props.customBackground,
640
650
  highlightEnabled: highlightEnabled,
@@ -139,7 +139,7 @@ export interface StackedBarChartPropsType {
139
139
  secondaryNoOfSectionsBelowXAxis: number;
140
140
  containerHeightIncludingBelowXAxis: number;
141
141
  highlightEnabled: boolean;
142
- highlightedBarIndex: number;
142
+ highlightedBarIndex: number | number[];
143
143
  lowlightOpacity: number;
144
144
  stackHighlightEnabled?: boolean;
145
145
  selectedStackIndex: number;
@@ -332,9 +332,9 @@ export interface BarChartPropsType {
332
332
  onScrollEndDrag?: (event: any, direction: any) => void;
333
333
  focusBarOnPress?: boolean;
334
334
  focusedBarConfig?: FocusedBarConfig;
335
- focusedBarIndex?: number;
335
+ focusedBarIndex?: number | number[];
336
336
  highlightEnabled?: boolean;
337
- highlightedBarIndex?: number;
337
+ highlightedBarIndex?: number | number[];
338
338
  lowlightOpacity?: number;
339
339
  stackHighlightEnabled?: boolean;
340
340
  highlightedStackIndex?: number;
@@ -605,14 +605,14 @@ export interface RenderBarsPropsType {
605
605
  autoCenterTooltip?: boolean;
606
606
  leftShiftForLastIndexTooltip: number;
607
607
  initialSpacing: number;
608
- selectedIndex: number;
608
+ selectedIndex: number[];
609
609
  setSelectedIndex: Function;
610
610
  barStyle?: object;
611
611
  xAxisThickness?: number;
612
612
  secondaryXAxis?: XAxisConfig;
613
613
  pointerConfig?: Pointer;
614
614
  focusBarOnPress?: boolean;
615
- focusedBarIndex?: number;
615
+ focusedBarIndex?: number | number[];
616
616
  noOfSectionsBelowXAxis?: number;
617
617
  yAxisOffset: number;
618
618
  stepHeight: number;
@@ -625,7 +625,7 @@ export interface RenderBarsPropsType {
625
625
  secondaryNegativeStepValue: number;
626
626
  secondaryNoOfSectionsBelowXAxis: number;
627
627
  highlightEnabled: boolean;
628
- highlightedBarIndex: number;
628
+ highlightedBarIndex: number | number[];
629
629
  lowlightOpacity: number;
630
630
  }
631
631
  export interface RenderBarsPropsTypeForWeb extends RenderBarsPropsType {
@@ -660,7 +660,7 @@ export interface animatedBarPropTypes {
660
660
  barStyle?: object;
661
661
  item: barDataItem;
662
662
  index: number;
663
- selectedIndex: number;
663
+ selectedIndex: number[];
664
664
  focusBarOnPress?: boolean;
665
665
  focusedBarConfig?: FocusedBarConfig;
666
666
  }
@@ -398,7 +398,7 @@ export var useLineChartBiColor = function (props) {
398
398
  scrollAnimation: scrollAnimation,
399
399
  scrollEventThrottle: scrollEventThrottle,
400
400
  indicatorColor: props.indicatorColor,
401
- selectedIndex: selectedIndex,
401
+ selectedIndex: [selectedIndex],
402
402
  setSelectedIndex: setSelectedIndex,
403
403
  spacing: spacing,
404
404
  showLine: false,
@@ -1345,7 +1345,7 @@ export var useLineChart = function (props) {
1345
1345
  scrollAnimation: scrollAnimation,
1346
1346
  scrollEventThrottle: scrollEventThrottle,
1347
1347
  indicatorColor: props.indicatorColor,
1348
- selectedIndex: selectedIndex,
1348
+ selectedIndex: [selectedIndex],
1349
1349
  setSelectedIndex: setSelectedIndex,
1350
1350
  spacing: spacing,
1351
1351
  showLine: false,
@@ -1,6 +1,6 @@
1
1
  import { GestureResponderEvent, type ColorValue } from 'react-native';
2
2
  import { type yAxisSides } from '../utils/constants';
3
- import { XAxisConfig, type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType, type Linecap, type IntersectionAreaConfig, CustomBackground } from '../utils/types';
3
+ import { XAxisConfig, type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType, type Linecap, type IntersectionAreaConfig, CustomBackground, SpreadData } from '../utils/types';
4
4
  export interface LineChartPropsType {
5
5
  height?: number;
6
6
  overflowTop?: number;
@@ -335,6 +335,9 @@ export interface LineChartPropsType {
335
335
  renderTooltipSecondary?: Function;
336
336
  dataPointLabelComponent?: Function;
337
337
  focusedDataPointLabelComponent?: Function;
338
+ spreadAreaData?: SpreadData[];
339
+ spreadAreaColor?: ColorValue;
340
+ spreadAreaOpacity?: number;
338
341
  }
339
342
  export interface lineDataItem {
340
343
  value?: number;
@@ -20,7 +20,7 @@ import { getBarSideColor, getBarTopColor } from '../../utils';
20
20
  export var useAnimatedThreeDBar = function (props) {
21
21
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
22
22
  var focusBarOnPress = props.focusBarOnPress, index = props.index, selectedIndex = props.selectedIndex, focusedBarConfig = props.focusedBarConfig, item = props.item;
23
- var isFocused = focusBarOnPress && index === selectedIndex;
23
+ var isFocused = focusBarOnPress && selectedIndex.includes(index);
24
24
  var localFrontColor = props.frontColor || BarDefaults.threeDBarFrontColor;
25
25
  var localGradientColor = props.gradientColor || BarDefaults.threeDBarGradientColor;
26
26
  var localSideColor = props.sideColor || BarDefaults.threeDBarSideColor;
package/dist/index.d.ts CHANGED
@@ -42,4 +42,4 @@ export { type StripAndLabelProps } from './components/common/types';
42
42
  /***********************************************************************************************************************/
43
43
  export { getCumulativeWidth, getLighterColor, svgQuadraticCurvePath, svgPath, bezierCommand, getSegmentString, getCurvePathWithSegments, getPreviousSegmentsLastPoint, getPathWithHighlight, getRegionPathObjects, getSegmentedPathObjects, getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getSecondaryDataWithOffsetIncluded, getArrowProperty, getAllArrowProperties, maxAndMinUtil, computeMaxAndMinItems, getLabelTextUtil, getXForLineInBar, getYForLineInBar, clone, getLineConfigForBarChart, adjustToOffset, pointsWithPaddedRepititions } from './utils';
44
44
  export { chartTypes, yAxisSides, loc, SEGMENT_START, SEGMENT_END, RANGE_ENTER, RANGE_EXIT, STOP, ruleTypes, AxesAndRulesDefaults, defaultArrowConfig, BarDefaults, defaultLineConfig, LineDefaults, defaultPointerConfig, pieColors, populationDefaults, defaultAnimationDuration } from './utils/constants';
45
- export { type RuleType, type RuleTypes, type RulesConfig, CurveType, EdgePosition, type LabelsPosition, type PointerEvents, type secondaryYAxisType, type secondaryLineConfigType, type referenceConfigType, type arrowConfigType, type horizSectionPropTypes, type HorizSectionsType, type BarAndLineChartsWrapperTypes, type Pointer, type HighlightedRange, type LineSegment, type LineSvgProps, type LineProperties, type DataSet, type DataSetNullSafe, Framework, type XAxisConfig, type LineInBarChartPropsType, type DataPointProps, type Linecap, type IntersectionAreaConfig, type LabelLineConfig, type TooltipProps } from './utils/types';
45
+ export { type RuleType, type RuleTypes, type RulesConfig, CurveType, EdgePosition, type LabelsPosition, type PointerEvents, type secondaryYAxisType, type secondaryLineConfigType, type referenceConfigType, type arrowConfigType, type horizSectionPropTypes, type HorizSectionsType, type BarAndLineChartsWrapperTypes, type Pointer, type HighlightedRange, type LineSegment, type LineSvgProps, type LineProperties, type DataSet, type DataSetNullSafe, Framework, type XAxisConfig, type LineInBarChartPropsType, type DataPointProps, type Linecap, type IntersectionAreaConfig, type LabelLineConfig, type TooltipProps, type SpreadData } from './utils/types';
@@ -332,8 +332,8 @@ export var radarChartDefaults = {
332
332
  hideAsterLines: false,
333
333
  hideGrid: false,
334
334
  hideLabels: false,
335
- labelsPositionOffset: 5,
336
- dataLabelsPositionOffset: 5,
335
+ labelsPositionOffset: 0,
336
+ dataLabelsPositionOffset: 0,
337
337
  gridSection: {
338
338
  stroke: 'lightgray',
339
339
  strokeWidth: 1,
@@ -23,6 +23,10 @@ export interface RuleTypes {
23
23
  DASHED: RuleType;
24
24
  DOTTED: RuleType;
25
25
  }
26
+ export interface SpreadData {
27
+ lower: number;
28
+ upper: number;
29
+ }
26
30
  export declare enum CurveType {
27
31
  CUBIC = 0,
28
32
  QUADRATIC = 1
@@ -147,7 +151,7 @@ export interface LineInBarChartPropsType {
147
151
  labelsExtraHeight: number;
148
152
  scrollEventThrottle: number;
149
153
  xAxisLabelsVerticalShift: number;
150
- selectedIndex: number;
154
+ selectedIndex: number[];
151
155
  yAxisOffset: number;
152
156
  strokeDashArray: number[];
153
157
  highlightEnabled: boolean;
@@ -291,7 +295,7 @@ export interface BarAndLineChartsWrapperTypes {
291
295
  scrollToIndex: number | undefined;
292
296
  scrollAnimation: boolean;
293
297
  indicatorColor: 'black' | 'default' | 'white' | undefined;
294
- selectedIndex: number;
298
+ selectedIndex: number[];
295
299
  setSelectedIndex: any;
296
300
  spacing: number;
297
301
  showLine: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.62",
3
+ "version": "0.1.64",
4
4
  "description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
5
5
  "main": "./dist/index.js",
6
6
  "files": [
@@ -15,10 +15,10 @@
15
15
  "@testing-library/jest-dom": "^6.4.8",
16
16
  "@testing-library/react": "^16.0.0",
17
17
  "@testing-library/user-event": "^14.5.2",
18
- "@typescript-eslint/eslint-plugin": "^7.17.0",
19
18
  "@types/react": "^18.3.3",
20
19
  "@types/react-dom": "^18.3.0",
21
20
  "@types/react-native": "^0.73.0",
21
+ "@typescript-eslint/eslint-plugin": "^7.17.0",
22
22
  "eslint": "^8.56.0",
23
23
  "eslint-config-love": "^62.0.0",
24
24
  "eslint-plugin-import": "^2.29.1",
@@ -29,7 +29,8 @@
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": "*",
32
- "react-native": "*"
32
+ "react-native": "*",
33
+ "react-native-svg": "*"
33
34
  },
34
35
  "eslintConfig": {
35
36
  "extends": [