gifted-charts-core 0.1.63 → 0.1.65

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.
@@ -139,8 +139,8 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
139
139
  rtl: boolean;
140
140
  intactTopLabel: boolean;
141
141
  showValuesAsTopLabel: boolean | undefined;
142
- topLabelContainerStyle: any;
143
- topLabelTextStyle: any;
142
+ topLabelContainerStyle: import("react-native").StyleProp<import("react-native").ViewStyle>;
143
+ topLabelTextStyle: import("react-native").StyleProp<import("react-native").TextStyle>;
144
144
  barBorderWidth: number | undefined;
145
145
  barBorderColor: import("react-native").ColorValue;
146
146
  barBorderRadius: number | undefined;
@@ -29,18 +29,18 @@ 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(function () {
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
38
  if (Array.isArray(focusedBarIndex)) {
39
39
  return focusedBarIndex;
40
40
  }
41
41
  return [focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1];
42
- }), 2), selectedIndex = _68[0], setSelectedIndex = _68[1];
43
- var _69 = __read(useState((_a = props.highlightedStackIndex) !== null && _a !== void 0 ? _a : -1), 2), selectedStackIndex = _69[0], setSelectedStackIndex = _69[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];
44
44
  var showLine = (_b = props.showLine) !== null && _b !== void 0 ? _b : BarDefaults.showLine;
45
45
  useEffect(function () {
46
46
  var newIndex = Array.isArray(focusedBarIndex)
@@ -93,29 +93,31 @@ export var useBarChart = function (props) {
93
93
  }
94
94
  return props.stackData;
95
95
  }, [yAxisOffset, props.stackData]);
96
- 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
97
99
  ? AxesAndRulesDefaults.yAxisEmptyLabelWidth
98
100
  : AxesAndRulesDefaults.yAxisLabelWidth);
99
101
  var autoComputedSectionWidth = props.initialSpacing !== undefined
100
- ? (parentWidth - yAxisLabelWidth) / data.length - props.initialSpacing
101
- : (parentWidth - yAxisLabelWidth) / (data.length + 0.5);
102
+ ? (parentWidth - yAxisLabelWidth) / dataLength - props.initialSpacing
103
+ : (parentWidth - yAxisLabelWidth) / (dataLength + 0.5);
102
104
  var autoComputedBarWidth = autoComputedSectionWidth * 0.6;
103
105
  var defaultBarWidth = adjustToWidth
104
106
  ? autoComputedBarWidth
105
107
  : BarDefaults.barWidth;
106
- var barWidth = (_h = props.barWidth) !== null && _h !== void 0 ? _h : defaultBarWidth;
108
+ var barWidth = (_m = props.barWidth) !== null && _m !== void 0 ? _m : defaultBarWidth;
107
109
  var autoComputedSpacing = autoComputedSectionWidth * 0.4;
108
- var spacing = (_j = props.spacing) !== null && _j !== void 0 ? _j : (adjustToWidth ? autoComputedSpacing : BarDefaults.spacing);
109
- var initialSpacing = (_k = props.initialSpacing) !== null && _k !== void 0 ? _k : spacing;
110
- var endSpacing = (_l = props.endSpacing) !== null && _l !== void 0 ? _l : spacing;
111
- var horizontal = (_m = props.horizontal) !== null && _m !== void 0 ? _m : BarDefaults.horizontal;
112
- var rtl = (_o = props.rtl) !== null && _o !== void 0 ? _o : BarDefaults.rtl;
113
- var yAxisAtTop = (_p = props.yAxisAtTop) !== null && _p !== void 0 ? _p : BarDefaults.yAxisAtTop;
114
- 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;
115
117
  var heightFromProps = horizontal ? props.width : props.height;
116
118
  var widthFromProps = horizontal ? props.height : props.width;
117
- var isAnimated = (_r = props.isAnimated) !== null && _r !== void 0 ? _r : BarDefaults.isAnimated;
118
- 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;
119
121
  // const secondaryData = getSecondaryDataWithOffsetIncluded(
120
122
  // props.secondaryData,
121
123
  // props.secondaryYAxis
@@ -133,7 +135,7 @@ export var useBarChart = function (props) {
133
135
  return props.lineData;
134
136
  }, [yAxisOffset, props.lineData, data, stackData]);
135
137
  var lineData2 = props.lineData2;
136
- 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;
137
139
  defaultLineConfig.initialSpacing = initialSpacing;
138
140
  defaultLineConfig.endIndex = lineData.length - 1;
139
141
  defaultLineConfig.animationDuration = animationDuration;
@@ -148,12 +150,12 @@ export var useBarChart = function (props) {
148
150
  ? props.stepHeight * noOfSections
149
151
  : AxesAndRulesDefaults.containerHeight);
150
152
  var horizSections = [{ value: '0' }];
151
- var stepHeight = (_u = props.stepHeight) !== null && _u !== void 0 ? _u : containerHeight / noOfSections;
152
- var labelWidth = (_v = props.labelWidth) !== null && _v !== void 0 ? _v : AxesAndRulesDefaults.labelWidth;
153
- var scrollToEnd = (_w = props.scrollToEnd) !== null && _w !== void 0 ? _w : BarDefaults.scrollToEnd;
154
- var scrollAnimation = (_x = props.scrollAnimation) !== null && _x !== void 0 ? _x : BarDefaults.scrollAnimation;
155
- var scrollEventThrottle = (_y = props.scrollEventThrottle) !== null && _y !== void 0 ? _y : BarDefaults.scrollEventThrottle;
156
- 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;
157
159
  var secondaryMaxItem = 0;
158
160
  var secondaryMinItem = 0;
159
161
  if (lineConfig.isSecondary) {
@@ -198,7 +200,7 @@ export var useBarChart = function (props) {
198
200
  }
199
201
  totalWidth +=
200
202
  ((_b = (_a = stackItem.stacks[0].barWidth) !== null && _a !== void 0 ? _a : props.barWidth) !== null && _b !== void 0 ? _b : defaultBarWidth) +
201
- (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);
202
204
  });
203
205
  }
204
206
  else {
@@ -225,17 +227,17 @@ export var useBarChart = function (props) {
225
227
  }
226
228
  totalWidth +=
227
229
  ((_b = (_a = item.barWidth) !== null && _a !== void 0 ? _a : props.barWidth) !== null && _b !== void 0 ? _b : defaultBarWidth) +
228
- (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);
229
231
  });
230
232
  }
231
233
  var valuesRange = maxItem - minPositiveItem; // Diff bw largest & smallest +ve values
232
- var showFractionalValues = (_0 = props.showFractionalValues) !== null && _0 !== void 0 ? _0 : valuesRange <= 1;
233
- 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);
234
236
  var maxAndMin = maxAndMinUtil(maxItem, minItem, roundToDigits, showFractionalValues);
235
237
  var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxAndMin.maxItem) || 10;
236
238
  var secondaryRange = secondaryMaxItem - secondaryMinPositiveItem; // Diff bw largest & smallest +ve values
237
- var showSecondaryFractionalValues = (_3 = (_2 = props.secondaryYAxis) === null || _2 === void 0 ? void 0 : _2.showFractionalValues) !== null && _3 !== void 0 ? _3 : secondaryRange <= 1;
238
- 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
239
241
  ? indexOfFirstNonZeroDigit(secondaryRange) + 1
240
242
  : 0);
241
243
  var secondaryMaxAndMin = maxAndMinUtil(secondaryMaxItem, secondaryMinItem, secondaryRoundToDigits, showSecondaryFractionalValues);
@@ -245,88 +247,88 @@ export var useBarChart = function (props) {
245
247
  // secondaryMaxAndMin.maxItem
246
248
  // : secondaryMaxAndMin.maxItem
247
249
  // : maxValue
248
- 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;
249
251
  var mostNegativeValue = getMostNegativeValue(props.mostNegativeValue, props.negativeStepValue, props.noOfSectionsBelowXAxis, maxAndMin.minItem);
250
- 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;
251
253
  var effectiveNegativeStepValue = negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue;
252
- var noOfSectionsBelowXAxis = (_9 = props.noOfSectionsBelowXAxis) !== null && _9 !== void 0 ? _9 : (effectiveNegativeStepValue
254
+ var noOfSectionsBelowXAxis = (_13 = props.noOfSectionsBelowXAxis) !== null && _13 !== void 0 ? _13 : (effectiveNegativeStepValue
253
255
  ? Math.round(Math.ceil(-mostNegativeValue / effectiveNegativeStepValue))
254
256
  : 0);
255
- var showScrollIndicator = (_10 = props.showScrollIndicator) !== null && _10 !== void 0 ? _10 : BarDefaults.showScrollIndicator;
256
- var side = (_11 = props.side) !== null && _11 !== void 0 ? _11 : BarDefaults.side;
257
- var rotateLabel = (_12 = props.rotateLabel) !== null && _12 !== void 0 ? _12 : AxesAndRulesDefaults.rotateLabel;
258
- var opacity = (_13 = props.opacity) !== null && _13 !== void 0 ? _13 : BarDefaults.opacity;
259
- var isThreeD = (_14 = props.isThreeD) !== null && _14 !== void 0 ? _14 : BarDefaults.isThreeD;
260
- var showXAxisIndices = (_15 = props.showXAxisIndices) !== null && _15 !== void 0 ? _15 : AxesAndRulesDefaults.showXAxisIndices;
261
- var xAxisIndicesHeight = (_16 = props.xAxisIndicesHeight) !== null && _16 !== void 0 ? _16 : AxesAndRulesDefaults.xAxisIndicesHeight;
262
- var xAxisIndicesWidth = (_17 = props.xAxisIndicesWidth) !== null && _17 !== void 0 ? _17 : AxesAndRulesDefaults.xAxisIndicesWidth;
263
- var xAxisIndicesColor = (_18 = props.xAxisIndicesColor) !== null && _18 !== void 0 ? _18 : AxesAndRulesDefaults.xAxisIndicesColor;
264
- var xAxisThickness = (_19 = props.xAxisThickness) !== null && _19 !== void 0 ? _19 : AxesAndRulesDefaults.xAxisThickness;
265
- var xAxisTextNumberOfLines = (_20 = props.xAxisTextNumberOfLines) !== null && _20 !== void 0 ? _20 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
266
- var xAxisLabelsVerticalShift = (_21 = props.xAxisLabelsVerticalShift) !== null && _21 !== void 0 ? _21 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
267
- 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;
268
270
  var horizontalRulesStyle = props.horizontalRulesStyle;
269
- var autoShiftLabels = (_23 = props.autoShiftLabels) !== null && _23 !== void 0 ? _23 : false;
270
- 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;
271
273
  var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
272
274
  var axesAndRulesProps = getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, roundToDigits, negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue, secondaryMaxValue, secondaryMinItem, showSecondaryFractionalValues, secondaryRoundToDigits);
273
- var _70 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepHeight = _70.stepHeight, secondaryStepValue = _70.stepValue, secondaryNegativeStepHeight = _70.negativeStepHeight, secondaryNegativeStepValue = _70.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _70.noOfSectionsBelowXAxis;
274
- 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);
275
277
  var secondary4thQuadrantHeight = secondaryNoOfSectionsBelowXAxis * secondaryNegativeStepHeight;
276
278
  var fourthQuadrantHeight = Math.max(primary4thQuadrantHeight, secondary4thQuadrantHeight);
277
279
  var containerHeightIncludingBelowXAxis = extendedContainerHeight + fourthQuadrantHeight;
278
- var _71 = __read(useState(-1), 2), pointerIndex = _71[0], setPointerIndex = _71[1];
279
- var _72 = __read(useState(0), 2), pointerX = _72[0], setPointerX = _72[1];
280
- var _73 = __read(useState(0), 2), pointerY = _73[0], setPointerY = _73[1];
281
- var _74 = __read(useState(), 2), pointerItem = _74[0], setPointerItem = _74[1];
282
- var _75 = __read(useState(0), 2), responderStartTime = _75[0], setResponderStartTime = _75[1];
283
- 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];
284
286
  var pointerConfig = props.pointerConfig;
285
- var getPointerProps = (_26 = props.getPointerProps) !== null && _26 !== void 0 ? _26 : null;
286
- var pointerHeight = (_27 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _27 !== void 0 ? _27 : defaultPointerConfig.height;
287
- var pointerWidth = (_28 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _28 !== void 0 ? _28 : defaultPointerConfig.width;
288
- var pointerRadius = (_29 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _29 !== void 0 ? _29 : defaultPointerConfig.radius;
289
- var pointerColor = (_30 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _30 !== void 0 ? _30 : defaultPointerConfig.pointerColor;
290
- 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;
291
293
  var showPointerStrip = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.showPointerStrip) === false
292
294
  ? false
293
295
  : defaultPointerConfig.showPointerStrip;
294
- var pointerStripHeight = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.pointerStripHeight;
295
- var pointerStripWidth = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.pointerStripWidth;
296
- var pointerStripColor = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _34 !== void 0 ? _34 : defaultPointerConfig.pointerStripColor;
297
- var pointerStripUptoDataPoint = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _35 !== void 0 ? _35 : defaultPointerConfig.pointerStripUptoDataPoint;
298
- var pointerLabelComponent = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.pointerLabelComponent;
299
- var stripOverPointer = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.stripOverPointer;
300
- var shiftPointerLabelX = (_38 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _38 !== void 0 ? _38 : defaultPointerConfig.shiftPointerLabelX;
301
- var shiftPointerLabelY = (_39 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _39 !== void 0 ? _39 : defaultPointerConfig.shiftPointerLabelY;
302
- var pointerLabelWidth = (_40 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _40 !== void 0 ? _40 : defaultPointerConfig.pointerLabelWidth;
303
- var pointerLabelHeight = (_41 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _41 !== void 0 ? _41 : defaultPointerConfig.pointerLabelHeight;
304
- var autoAdjustPointerLabelPosition = (_42 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _42 !== void 0 ? _42 : defaultPointerConfig.autoAdjustPointerLabelPosition;
305
- var pointerVanishDelay = (_43 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _43 !== void 0 ? _43 : defaultPointerConfig.pointerVanishDelay;
306
- var activatePointersOnLongPress = (_44 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _44 !== void 0 ? _44 : defaultPointerConfig.activatePointersOnLongPress;
307
- var activatePointersDelay = (_45 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _45 !== void 0 ? _45 : defaultPointerConfig.activatePointersDelay;
308
- var initialPointerIndex = (_46 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _46 !== void 0 ? _46 : defaultPointerConfig.initialPointerIndex;
309
- 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
310
312
  ? animationDuration
311
313
  : defaultPointerConfig.initialPointerAppearDelay);
312
- var persistPointer = (_48 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _48 !== void 0 ? _48 : defaultPointerConfig.persistPointer;
313
- 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;
314
316
  var pointerEvents = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerEvents;
315
- var stripBehindBars = (_50 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _50 !== void 0 ? _50 : defaultPointerConfig.stripBehindBars;
316
- 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
317
319
  ? activatePointersOnLongPress
318
320
  ? !!responderActive
319
321
  : true
320
322
  : false);
321
323
  var yAxisExtraHeightAtTop = props.trimYAxisAtTop
322
324
  ? 0
323
- : (_52 = props.yAxisExtraHeight) !== null && _52 !== void 0 ? _52 : containerHeight / 20;
325
+ : (_56 = props.yAxisExtraHeight) !== null && _56 !== void 0 ? _56 : containerHeight / 20;
324
326
  var barInnerComponent = props.barInnerComponent;
325
327
  var localYAxisOffset1 = lineConfig.isSecondary
326
- ? (_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
327
329
  : yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
328
330
  var localYAxisOffset2 = lineConfig2.isSecondary
329
- ? (_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
330
332
  : yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
331
333
  useEffect(function () {
332
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;
@@ -442,9 +444,9 @@ export var useBarChart = function (props) {
442
444
  spacing,
443
445
  yAxisLabelWidth,
444
446
  lineConfig.showArrow,
445
- (_57 = lineConfig.arrowConfig) === null || _57 === void 0 ? void 0 : _57.length,
446
- (_58 = lineConfig.arrowConfig) === null || _58 === void 0 ? void 0 : _58.width,
447
- (_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
448
450
  ]);
449
451
  useEffect(function () {
450
452
  var _a, _b;
@@ -581,19 +583,19 @@ export var useBarChart = function (props) {
581
583
  containerHeight: containerHeight,
582
584
  noOfSectionsBelowXAxis: noOfSectionsBelowXAxis,
583
585
  stepHeight: stepHeight,
584
- negativeStepHeight: (_60 = props.negativeStepHeight) !== null && _60 !== void 0 ? _60 : stepHeight,
586
+ negativeStepHeight: (_64 = props.negativeStepHeight) !== null && _64 !== void 0 ? _64 : stepHeight,
585
587
  labelsExtraHeight: labelsExtraHeight,
586
588
  yAxisLabelWidth: yAxisLabelWidth,
587
589
  horizontal: horizontal,
588
590
  rtl: rtl,
589
- shiftX: (_61 = props.shiftX) !== null && _61 !== void 0 ? _61 : 0,
590
- 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,
591
593
  yAxisAtTop: yAxisAtTop,
592
594
  initialSpacing: initialSpacing,
593
595
  data: data,
594
596
  stackData: stackData,
595
597
  // secondaryData,
596
- barWidth: (_63 = props.barWidth) !== null && _63 !== void 0 ? _63 : defaultBarWidth,
598
+ barWidth: (_67 = props.barWidth) !== null && _67 !== void 0 ? _67 : defaultBarWidth,
597
599
  xAxisThickness: xAxisThickness,
598
600
  totalWidth: totalWidth,
599
601
  disableScroll: disableScroll,
@@ -642,7 +644,7 @@ export var useBarChart = function (props) {
642
644
  pointerY: pointerY,
643
645
  onEndReached: props.onEndReached,
644
646
  onStartReached: props.onStartReached,
645
- endReachedOffset: (_64 = props.endReachedOffset) !== null && _64 !== void 0 ? _64 : BarDefaults.endReachedOffset,
647
+ endReachedOffset: (_68 = props.endReachedOffset) !== null && _68 !== void 0 ? _68 : BarDefaults.endReachedOffset,
646
648
  onMomentumScrollEnd: props.onMomentumScrollEnd,
647
649
  customBackground: props.customBackground,
648
650
  highlightEnabled: highlightEnabled,
@@ -1,4 +1,4 @@
1
- import { type ColorValue, type GestureResponderEvent, type ViewStyle } from 'react-native';
1
+ import { StyleProp, TextStyle, type ColorValue, type GestureResponderEvent, type ViewStyle } from 'react-native';
2
2
  import { type yAxisSides } from '../utils/constants';
3
3
  import { XAxisConfig, type CurveType, type Pointer, type RuleType, type RulesConfig, type referenceConfigType, type secondaryYAxisType, type Linecap, CustomBackground } from '../utils/types';
4
4
  import { type Component, type ReactNode } from 'react';
@@ -13,10 +13,10 @@ export interface stackDataItem {
13
13
  labelsDistanceFromXaxis?: number;
14
14
  barWidth?: number;
15
15
  spacing?: number;
16
- labelTextStyle?: any;
16
+ labelTextStyle?: StyleProp<TextStyle>;
17
17
  topLabelComponent?: Function;
18
- topLabelContainerStyle?: any;
19
- topLabelTextStyle?: any;
18
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
19
+ topLabelTextStyle?: StyleProp<TextStyle>;
20
20
  disablePress?: any;
21
21
  color?: ColorValue;
22
22
  showGradient?: boolean;
@@ -64,11 +64,11 @@ export interface StackedBarChartPropsType {
64
64
  height?: number;
65
65
  color?: ColorValue;
66
66
  topLabelComponent?: Component;
67
- topLabelContainerStyle?: any;
68
- topLabelTextStyle?: any;
67
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
68
+ topLabelTextStyle?: StyleProp<TextStyle>;
69
69
  opacity?: number;
70
70
  label: string;
71
- labelTextStyle?: any;
71
+ labelTextStyle?: StyleProp<TextStyle>;
72
72
  autoShiftLabelsForNegativeStacks?: boolean;
73
73
  labelsDistanceFromXaxis?: number;
74
74
  xAxisLabelsAtBottom?: boolean;
@@ -186,9 +186,9 @@ export interface BarChartPropsType {
186
186
  yAxisExtraHeight?: number;
187
187
  trimYAxisAtTop?: boolean;
188
188
  xAxisType?: RuleType;
189
- yAxisLabelContainerStyle?: any;
189
+ yAxisLabelContainerStyle?: StyleProp<ViewStyle>;
190
190
  horizontalRulesStyle?: any;
191
- yAxisTextStyle?: any;
191
+ yAxisTextStyle?: StyleProp<TextStyle>;
192
192
  yAxisTextNumberOfLines?: number;
193
193
  xAxisTextNumberOfLines?: number;
194
194
  xAxisLabelsHeight?: number;
@@ -275,8 +275,8 @@ export interface BarChartPropsType {
275
275
  yAxisAtTop?: boolean;
276
276
  intactTopLabel?: boolean;
277
277
  showValuesAsTopLabel?: boolean;
278
- topLabelContainerStyle?: any;
279
- topLabelTextStyle?: any;
278
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
279
+ topLabelTextStyle?: StyleProp<TextStyle>;
280
280
  horizSections?: sectionType[];
281
281
  barBorderWidth?: number;
282
282
  barBorderColor?: ColorValue;
@@ -294,7 +294,7 @@ export interface BarChartPropsType {
294
294
  labelWidth?: number;
295
295
  yAxisLabelTexts?: string[];
296
296
  xAxisLabelTexts?: string[];
297
- xAxisLabelTextStyle?: any;
297
+ xAxisLabelTextStyle?: StyleProp<TextStyle>;
298
298
  yAxisLabelPrefix?: string;
299
299
  yAxisLabelSuffix?: string;
300
300
  autoShiftLabels?: boolean;
@@ -449,9 +449,9 @@ export interface barDataItem {
449
449
  sideWidth?: number;
450
450
  barBorderWidth?: number;
451
451
  barBorderColor?: ColorValue;
452
- labelTextStyle?: any;
452
+ labelTextStyle?: StyleProp<TextStyle>;
453
453
  topLabelComponent?: Function;
454
- topLabelContainerStyle?: any;
454
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
455
455
  disablePress?: any;
456
456
  capThickness?: number;
457
457
  capColor?: ColorValue;
@@ -467,7 +467,7 @@ export interface barDataItem {
467
467
  labelWidth?: number;
468
468
  secondaryLabel?: string;
469
469
  secondaryLabelComponent?: Function;
470
- secondaryLabelTextStyle?: any;
470
+ secondaryLabelTextStyle?: StyleProp<TextStyle>;
471
471
  barBackgroundPattern?: () => ReactNode;
472
472
  patternId?: string;
473
473
  barMarginBottom?: number;
@@ -505,8 +505,8 @@ export interface Animated2DWithGradientPropsType {
505
505
  horizontal: boolean;
506
506
  intactTopLabel: boolean;
507
507
  showValuesAsTopLabel: boolean;
508
- topLabelContainerStyle?: any;
509
- topLabelTextStyle?: any;
508
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
509
+ topLabelTextStyle?: StyleProp<TextStyle>;
510
510
  barBorderWidth?: number;
511
511
  barBorderColor: ColorValue;
512
512
  barBorderRadius?: number;
@@ -526,7 +526,7 @@ export interface Animated2DWithGradientPropsType {
526
526
  yAxisOffset: number;
527
527
  }
528
528
  export interface RenderBarsPropsType {
529
- style?: any;
529
+ style?: StyleProp<ViewStyle>;
530
530
  width?: number;
531
531
  height?: number;
532
532
  minHeight: number;
@@ -537,12 +537,12 @@ export interface RenderBarsPropsType {
537
537
  sideColor?: ColorValue;
538
538
  topColor?: ColorValue;
539
539
  topLabelComponent?: Component;
540
- topLabelContainerStyle?: any;
541
- topLabelTextStyle?: any;
540
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
541
+ topLabelTextStyle?: StyleProp<TextStyle>;
542
542
  opacity?: number;
543
543
  side?: string;
544
- labelTextStyle?: any;
545
- secondaryLabelTextStyle?: any;
544
+ labelTextStyle?: StyleProp<TextStyle>;
545
+ secondaryLabelTextStyle?: StyleProp<TextStyle>;
546
546
  item: barDataItemNullSafe;
547
547
  index: number;
548
548
  label: string;
@@ -652,8 +652,8 @@ export interface animatedBarPropTypes {
652
652
  horizontal: boolean;
653
653
  intactTopLabel: boolean;
654
654
  showValuesAsTopLabel: boolean;
655
- topLabelContainerStyle?: any;
656
- topLabelTextStyle?: any;
655
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
656
+ topLabelTextStyle?: StyleProp<TextStyle>;
657
657
  barBackgroundPattern?: () => ReactNode;
658
658
  barInnerComponent?: (item?: barDataItem, index?: number) => ReactNode;
659
659
  patternId?: string;
@@ -679,8 +679,8 @@ export interface CommonPropsFor2dand3dBarsType {
679
679
  height: number;
680
680
  intactTopLabel: boolean;
681
681
  showValuesAsTopLabel: boolean;
682
- topLabelContainerStyle: any;
683
- topLabelTextStyle: any;
682
+ topLabelContainerStyle: StyleProp<ViewStyle>;
683
+ topLabelTextStyle: StyleProp<TextStyle>;
684
684
  yAxisOffset: number;
685
685
  }
686
686
  export interface BarChartPropsTypeForWeb extends BarChartPropsType {
@@ -96,5 +96,6 @@ export declare const useLineChartBiColor: (props: extendedLineChartBicolorPropsT
96
96
  value: string;
97
97
  }[];
98
98
  barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes;
99
+ yAxisExtraHeightAtTop: number;
99
100
  };
100
101
  export {};
@@ -28,11 +28,11 @@ import { AxesAndRulesDefaults, LineDefaults, chartTypes } from '../utils/constan
28
28
  import { getAxesAndRulesProps, getExtendedContainerHeightWithPadding } from '../utils';
29
29
  var initialData = null;
30
30
  export var useLineChartBiColor = function (props) {
31
- 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;
32
- var _52 = __read(useState(false), 2), toggle = _52[0], setToggle = _52[1];
33
- var _53 = __read(useState([]), 2), pointsArray = _53[0], setPointsArray = _53[1];
34
- var _54 = __read(useState([]), 2), fillPointsArray = _54[0], setFillPointsArray = _54[1];
35
- var _55 = __read(useState(-1), 2), selectedIndex = _55[0], setSelectedIndex = _55[1];
31
+ 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;
32
+ var _53 = __read(useState(false), 2), toggle = _53[0], setToggle = _53[1];
33
+ var _54 = __read(useState([]), 2), pointsArray = _54[0], setPointsArray = _54[1];
34
+ var _55 = __read(useState([]), 2), fillPointsArray = _55[0], setFillPointsArray = _55[1];
35
+ var _56 = __read(useState(-1), 2), selectedIndex = _56[0], setSelectedIndex = _56[1];
36
36
  var containerHeight = (_a = props.height) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.containerHeight;
37
37
  var noOfSections = (_b = props.noOfSections) !== null && _b !== void 0 ? _b : AxesAndRulesDefaults.noOfSections;
38
38
  var data = useMemo(function () {
@@ -340,34 +340,37 @@ export var useLineChartBiColor = function (props) {
340
340
  var yAxisLabelWidth = (_33 = props.yAxisLabelWidth) !== null && _33 !== void 0 ? _33 : (props.hideYAxisText
341
341
  ? AxesAndRulesDefaults.yAxisEmptyLabelWidth
342
342
  : AxesAndRulesDefaults.yAxisLabelWidth);
343
+ var yAxisExtraHeightAtTop = props.trimYAxisAtTop
344
+ ? 0
345
+ : (_34 = props.yAxisExtraHeight) !== null && _34 !== void 0 ? _34 : containerHeight / 20;
343
346
  var horizontal = false;
344
347
  var yAxisAtTop = false;
345
- var disableScroll = (_34 = props.disableScroll) !== null && _34 !== void 0 ? _34 : LineDefaults.disableScroll;
346
- var showScrollIndicator = (_35 = props.showScrollIndicator) !== null && _35 !== void 0 ? _35 : LineDefaults.showScrollIndicator;
347
- var focusEnabled = (_36 = props.focusEnabled) !== null && _36 !== void 0 ? _36 : LineDefaults.focusEnabled;
348
- var showDataPointOnFocus = (_37 = props.showDataPointOnFocus) !== null && _37 !== void 0 ? _37 : LineDefaults.showDataPointOnFocus;
349
- var showStripOnFocus = (_38 = props.showStripOnFocus) !== null && _38 !== void 0 ? _38 : LineDefaults.showStripOnFocus;
350
- var showTextOnFocus = (_39 = props.showTextOnFocus) !== null && _39 !== void 0 ? _39 : LineDefaults.showTextOnFocus;
348
+ var disableScroll = (_35 = props.disableScroll) !== null && _35 !== void 0 ? _35 : LineDefaults.disableScroll;
349
+ var showScrollIndicator = (_36 = props.showScrollIndicator) !== null && _36 !== void 0 ? _36 : LineDefaults.showScrollIndicator;
350
+ var focusEnabled = (_37 = props.focusEnabled) !== null && _37 !== void 0 ? _37 : LineDefaults.focusEnabled;
351
+ var showDataPointOnFocus = (_38 = props.showDataPointOnFocus) !== null && _38 !== void 0 ? _38 : LineDefaults.showDataPointOnFocus;
352
+ var showStripOnFocus = (_39 = props.showStripOnFocus) !== null && _39 !== void 0 ? _39 : LineDefaults.showStripOnFocus;
353
+ var showTextOnFocus = (_40 = props.showTextOnFocus) !== null && _40 !== void 0 ? _40 : LineDefaults.showTextOnFocus;
351
354
  var stripHeight = props.stripHeight;
352
- var stripWidth = (_40 = props.stripWidth) !== null && _40 !== void 0 ? _40 : LineDefaults.stripWidth;
353
- var stripColor = (_41 = props.stripColor) !== null && _41 !== void 0 ? _41 : color;
354
- var stripOpacity = (_42 = props.stripOpacity) !== null && _42 !== void 0 ? _42 : (startOpacity + endOpacity) / 2;
355
- var unFocusOnPressOut = (_43 = props.unFocusOnPressOut) !== null && _43 !== void 0 ? _43 : LineDefaults.unFocusOnPressOut;
356
- var delayBeforeUnFocus = (_44 = props.delayBeforeUnFocus) !== null && _44 !== void 0 ? _44 : LineDefaults.delayBeforeUnFocus;
355
+ var stripWidth = (_41 = props.stripWidth) !== null && _41 !== void 0 ? _41 : LineDefaults.stripWidth;
356
+ var stripColor = (_42 = props.stripColor) !== null && _42 !== void 0 ? _42 : color;
357
+ var stripOpacity = (_43 = props.stripOpacity) !== null && _43 !== void 0 ? _43 : (startOpacity + endOpacity) / 2;
358
+ var unFocusOnPressOut = (_44 = props.unFocusOnPressOut) !== null && _44 !== void 0 ? _44 : LineDefaults.unFocusOnPressOut;
359
+ var delayBeforeUnFocus = (_45 = props.delayBeforeUnFocus) !== null && _45 !== void 0 ? _45 : LineDefaults.delayBeforeUnFocus;
357
360
  horizSections.pop();
358
361
  for (var i = 0; i <= noOfSections; i++) {
359
362
  var value = maxValue - stepValue * i;
360
- if ((_45 = props.showFractionalValues) !== null && _45 !== void 0 ? _45 : props.roundToDigits) {
361
- value = parseFloat(value.toFixed((_46 = props.roundToDigits) !== null && _46 !== void 0 ? _46 : 1));
363
+ if ((_46 = props.showFractionalValues) !== null && _46 !== void 0 ? _46 : props.roundToDigits) {
364
+ value = parseFloat(value.toFixed((_47 = props.roundToDigits) !== null && _47 !== void 0 ? _47 : 1));
362
365
  }
363
366
  horizSections.push({
364
367
  value: props.yAxisLabelTexts
365
- ? (_47 = props.yAxisLabelTexts[noOfSections - i]) !== null && _47 !== void 0 ? _47 : value.toString()
368
+ ? (_48 = props.yAxisLabelTexts[noOfSections - i]) !== null && _48 !== void 0 ? _48 : value.toString()
366
369
  : value.toString()
367
370
  });
368
371
  }
369
- var dataPointsRadius = (_48 = props.dataPointsRadius) !== null && _48 !== void 0 ? _48 : LineDefaults.dataPointsRadius;
370
- var dataPointsWidth = (_49 = props.dataPointsWidth) !== null && _49 !== void 0 ? _49 : LineDefaults.dataPointsWidth;
372
+ var dataPointsRadius = (_49 = props.dataPointsRadius) !== null && _49 !== void 0 ? _49 : LineDefaults.dataPointsRadius;
373
+ var dataPointsWidth = (_50 = props.dataPointsWidth) !== null && _50 !== void 0 ? _50 : LineDefaults.dataPointsWidth;
371
374
  var extraWidthDueToDataPoint = props.hideDataPoints
372
375
  ? 0
373
376
  : dataPointsRadius !== null && dataPointsRadius !== void 0 ? dataPointsRadius : dataPointsWidth;
@@ -419,7 +422,7 @@ export var useLineChartBiColor = function (props) {
419
422
  horizontalRulesStyle: horizontalRulesStyle,
420
423
  noOfSections: noOfSections,
421
424
  showFractionalValues: showFractionalValues,
422
- axesAndRulesProps: getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, (_50 = props.roundToDigits) !== null && _50 !== void 0 ? _50 : 0, stepValue, 0, 0, false, 0),
425
+ axesAndRulesProps: getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, (_51 = props.roundToDigits) !== null && _51 !== void 0 ? _51 : 0, stepValue, 0, 0, false, 0),
423
426
  yAxisLabelTexts: props.yAxisLabelTexts,
424
427
  yAxisOffset: props.yAxisOffset,
425
428
  rotateYAxisTexts: 0,
@@ -434,7 +437,7 @@ export var useLineChartBiColor = function (props) {
434
437
  pointerIndex: 0,
435
438
  pointerX: 0,
436
439
  pointerY: 0,
437
- endReachedOffset: (_51 = props.endReachedOffset) !== null && _51 !== void 0 ? _51 : LineDefaults.endReachedOffset,
440
+ endReachedOffset: (_52 = props.endReachedOffset) !== null && _52 !== void 0 ? _52 : LineDefaults.endReachedOffset,
438
441
  extraWidthDueToDataPoint: extraWidthDueToDataPoint,
439
442
  highlightEnabled: LineDefaults.highlightEnabled,
440
443
  lowlightOpacity: LineDefaults.lowlightOpacity,
@@ -527,6 +530,7 @@ export var useLineChartBiColor = function (props) {
527
530
  unFocusOnPressOut: unFocusOnPressOut,
528
531
  delayBeforeUnFocus: delayBeforeUnFocus,
529
532
  horizSections: horizSections,
530
- barAndLineChartsWrapperProps: barAndLineChartsWrapperProps
533
+ barAndLineChartsWrapperProps: barAndLineChartsWrapperProps,
534
+ yAxisExtraHeightAtTop: yAxisExtraHeightAtTop
531
535
  };
532
536
  };
@@ -1,6 +1,6 @@
1
- import { GestureResponderEvent, type ColorValue } from 'react-native';
1
+ import { GestureResponderEvent, StyleProp, TextStyle, ViewStyle, 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;
@@ -158,9 +158,9 @@ export interface LineChartPropsType {
158
158
  yAxisColor?: ColorValue;
159
159
  yAxisExtraHeight?: number;
160
160
  trimYAxisAtTop?: boolean;
161
- yAxisLabelContainerStyle?: any;
161
+ yAxisLabelContainerStyle?: StyleProp<ViewStyle>;
162
162
  horizontalRulesStyle?: any;
163
- yAxisTextStyle?: any;
163
+ yAxisTextStyle?: StyleProp<TextStyle>;
164
164
  yAxisTextNumberOfLines?: number;
165
165
  xAxisTextNumberOfLines?: number;
166
166
  showFractionalValues?: boolean;
@@ -265,7 +265,7 @@ export interface LineChartPropsType {
265
265
  textShiftY?: number;
266
266
  yAxisLabelTexts?: string[];
267
267
  xAxisLabelTexts?: string[];
268
- xAxisLabelTextStyle?: any;
268
+ xAxisLabelTextStyle?: StyleProp<TextStyle>;
269
269
  xAxisLabelsHeight?: number;
270
270
  xAxisLabelsVerticalShift?: number;
271
271
  xAxisLabelsAtBottom?: boolean;
@@ -335,15 +335,18 @@ 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;
341
344
  label?: string;
342
345
  labelComponent?: Function;
343
- labelTextStyle?: any;
346
+ labelTextStyle?: StyleProp<TextStyle>;
344
347
  secondaryLabel?: string;
345
348
  secondaryLabelComponent?: Function;
346
- secondaryLabelTextStyle?: any;
349
+ secondaryLabelTextStyle?: StyleProp<TextStyle>;
347
350
  dataPointText?: string;
348
351
  textShiftX?: number;
349
352
  textShiftY?: number;
@@ -399,7 +402,7 @@ export interface bicolorLineDataItem {
399
402
  value: number;
400
403
  label?: string;
401
404
  labelComponent?: Function;
402
- labelTextStyle?: any;
405
+ labelTextStyle?: StyleProp<TextStyle>;
403
406
  dataPointText?: string;
404
407
  textShiftX?: number;
405
408
  textShiftY?: number;
@@ -524,9 +527,9 @@ export interface LineChartBicolorPropsType {
524
527
  colorNegative?: string;
525
528
  yAxisThickness?: number;
526
529
  yAxisColor?: ColorValue;
527
- yAxisLabelContainerStyle?: any;
530
+ yAxisLabelContainerStyle?: StyleProp<ViewStyle>;
528
531
  horizontalRulesStyle?: any;
529
- yAxisTextStyle?: any;
532
+ yAxisTextStyle?: StyleProp<TextStyle>;
530
533
  yAxisTextNumberOfLines?: number;
531
534
  xAxisTextNumberOfLines?: number;
532
535
  showFractionalValues?: boolean;
@@ -568,7 +571,7 @@ export interface LineChartBicolorPropsType {
568
571
  textShiftY?: number;
569
572
  yAxisLabelTexts?: string[];
570
573
  xAxisLabelTexts?: string[];
571
- xAxisLabelTextStyle?: any;
574
+ xAxisLabelTextStyle?: StyleProp<TextStyle>;
572
575
  width?: number;
573
576
  yAxisLabelPrefix?: string;
574
577
  yAxisLabelSuffix?: string;
@@ -587,6 +590,8 @@ export interface LineChartBicolorPropsType {
587
590
  overScrollMode?: 'auto' | 'always' | 'never';
588
591
  onScrollEndDrag?: (event: any, direction: any) => void;
589
592
  parentWidth?: number;
593
+ yAxisExtraHeight?: number;
594
+ trimYAxisAtTop?: boolean;
590
595
  }
591
596
  export interface LineChartPropsTypeForWeb extends LineChartPropsType {
592
597
  onContextMenu?: Function;
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.63",
3
+ "version": "0.1.65",
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": [