gifted-charts-core 0.1.70 → 0.1.72

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.
@@ -1,4 +1,4 @@
1
- import { type lineConfigType, type barDataItem, type stackDataItem, BarChartPropsTypeForWeb, barDataItemNullSafe } from './types';
1
+ import { type barDataItem, type stackDataItem, BarChartPropsTypeForWeb, barDataItemNullSafe, lineConfigWithSetFocusedDataPointIndexType } from './types';
2
2
  import { type BarAndLineChartsWrapperTypes, type secondaryYAxisType } from '../utils/types';
3
3
  import { type Animated } from 'react-native';
4
4
  export interface extendedBarChartPropsType extends BarChartPropsTypeForWeb {
@@ -10,7 +10,7 @@ export interface extendedBarChartPropsType extends BarChartPropsTypeForWeb {
10
10
  secondaryYAxis?: secondaryYAxisType | boolean;
11
11
  }
12
12
  export declare const useBarChart: (props: extendedBarChartPropsType) => {
13
- lineConfig: lineConfigType;
13
+ lineConfig: lineConfigWithSetFocusedDataPointIndexType;
14
14
  hidePointer1: boolean;
15
15
  pointerItem: barDataItem | stackDataItem | undefined;
16
16
  pointerY: number;
@@ -94,7 +94,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
94
94
  scrollAnimation: boolean;
95
95
  scrollEventThrottle: number;
96
96
  showLine: boolean;
97
- lineConfig2: lineConfigType;
97
+ lineConfig2: lineConfigWithSetFocusedDataPointIndexType;
98
98
  lineData: (import("..").lineDataItem | barDataItem | stackDataItem)[];
99
99
  lineData2: (import("..").lineDataItem | barDataItem | stackDataItem)[] | undefined;
100
100
  animatedWidth: Animated.AnimatedInterpolation<string | number> | undefined;
@@ -29,20 +29,20 @@ 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, _65, _66, _67, _68, _69;
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, _69, _70, _71, _72, _73, _74, _75, _76, _77;
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, nsv = props.negativeStepValue, autoCenterTooltip = props.autoCenterTooltip, floatingYAxisLabels = props.floatingYAxisLabels;
34
34
  var negativeStepValue = nsv ? Math.abs(nsv) : undefined;
35
35
  var allowFontScaling = (_a = props.allowFontScaling) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.allowFontScaling;
36
- var _70 = __read(useState(''), 2), points = _70[0], setPoints = _70[1];
37
- var _71 = __read(useState(''), 2), points2 = _71[0], setPoints2 = _71[1];
38
- var _72 = __read(useState(''), 2), arrowPoints = _72[0], setArrowPoints = _72[1];
39
- var _73 = __read(useState(function () {
36
+ var _78 = __read(useState(''), 2), points = _78[0], setPoints = _78[1];
37
+ var _79 = __read(useState(''), 2), points2 = _79[0], setPoints2 = _79[1];
38
+ var _80 = __read(useState(''), 2), arrowPoints = _80[0], setArrowPoints = _80[1];
39
+ var _81 = __read(useState(function () {
40
40
  if (Array.isArray(focusedBarIndex)) {
41
41
  return focusedBarIndex;
42
42
  }
43
43
  return [focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1];
44
- }), 2), selectedIndex = _73[0], setSelectedIndex = _73[1];
45
- var _74 = __read(useState((_b = props.highlightedStackIndex) !== null && _b !== void 0 ? _b : -1), 2), selectedStackIndex = _74[0], setSelectedStackIndex = _74[1];
44
+ }), 2), selectedIndex = _81[0], setSelectedIndex = _81[1];
45
+ var _82 = __read(useState((_b = props.highlightedStackIndex) !== null && _b !== void 0 ? _b : -1), 2), selectedStackIndex = _82[0], setSelectedStackIndex = _82[1];
46
46
  var showLine = (_c = props.showLine) !== null && _c !== void 0 ? _c : BarDefaults.showLine;
47
47
  useEffect(function () {
48
48
  var newIndex = Array.isArray(focusedBarIndex)
@@ -141,23 +141,26 @@ export var useBarChart = function (props) {
141
141
  defaultLineConfig.initialSpacing = initialSpacing;
142
142
  defaultLineConfig.endIndex = lineData.length - 1;
143
143
  defaultLineConfig.animationDuration = animationDuration;
144
+ var _83 = __read(useState((_0 = (_z = props.lineConfig) === null || _z === void 0 ? void 0 : _z.focusedDataPointIndex) !== null && _0 !== void 0 ? _0 : -1), 2), focusedDataPointIndex = _83[0], setFocusedDataPointIndex = _83[1];
145
+ var _84 = __read(useState((_2 = (_1 = props.lineConfig2) === null || _1 === void 0 ? void 0 : _1.focusedDataPointIndex) !== null && _2 !== void 0 ? _2 : -1), 2), focusedDataPointIndex2 = _84[0], setFocusedDataPointIndex2 = _84[1];
144
146
  var lineConfig = props.lineConfig
145
- ? getLineConfigForBarChart(props.lineConfig, initialSpacing)
147
+ ? getLineConfigForBarChart(props.lineConfig, initialSpacing, focusedDataPointIndex, setFocusedDataPointIndex)
146
148
  : defaultLineConfig;
147
149
  var lineConfig2 = props.lineConfig2
148
- ? getLineConfigForBarChart(props.lineConfig2, initialSpacing)
150
+ ? getLineConfigForBarChart(props.lineConfig2, initialSpacing, focusedDataPointIndex2, setFocusedDataPointIndex2)
149
151
  : defaultLineConfig;
150
152
  var noOfSections = getNoOfSections(props.noOfSections, props.maxValue, props.stepValue);
153
+ var secondaryNoOfSections = getNoOfSections((_4 = (_3 = props.secondaryYAxis) === null || _3 === void 0 ? void 0 : _3.noOfSections) !== null && _4 !== void 0 ? _4 : noOfSections, (_5 = props.secondaryYAxis) === null || _5 === void 0 ? void 0 : _5.maxValue, (_6 = props.secondaryYAxis) === null || _6 === void 0 ? void 0 : _6.stepValue);
151
154
  var containerHeight = heightFromProps !== null && heightFromProps !== void 0 ? heightFromProps : (props.stepHeight
152
155
  ? props.stepHeight * noOfSections
153
156
  : AxesAndRulesDefaults.containerHeight);
154
157
  var horizSections = [{ value: '0' }];
155
- var stepHeight = (_z = props.stepHeight) !== null && _z !== void 0 ? _z : containerHeight / noOfSections;
156
- var labelWidth = (_0 = props.labelWidth) !== null && _0 !== void 0 ? _0 : AxesAndRulesDefaults.labelWidth;
157
- var scrollToEnd = (_1 = props.scrollToEnd) !== null && _1 !== void 0 ? _1 : BarDefaults.scrollToEnd;
158
- var scrollAnimation = (_2 = props.scrollAnimation) !== null && _2 !== void 0 ? _2 : BarDefaults.scrollAnimation;
159
- var scrollEventThrottle = (_3 = props.scrollEventThrottle) !== null && _3 !== void 0 ? _3 : BarDefaults.scrollEventThrottle;
160
- var labelsExtraHeight = (_4 = props.labelsExtraHeight) !== null && _4 !== void 0 ? _4 : AxesAndRulesDefaults.labelsExtraHeight;
158
+ var stepHeight = (_7 = props.stepHeight) !== null && _7 !== void 0 ? _7 : containerHeight / noOfSections;
159
+ var labelWidth = (_8 = props.labelWidth) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.labelWidth;
160
+ var scrollToEnd = (_9 = props.scrollToEnd) !== null && _9 !== void 0 ? _9 : BarDefaults.scrollToEnd;
161
+ var scrollAnimation = (_10 = props.scrollAnimation) !== null && _10 !== void 0 ? _10 : BarDefaults.scrollAnimation;
162
+ var scrollEventThrottle = (_11 = props.scrollEventThrottle) !== null && _11 !== void 0 ? _11 : BarDefaults.scrollEventThrottle;
163
+ var labelsExtraHeight = (_12 = props.labelsExtraHeight) !== null && _12 !== void 0 ? _12 : AxesAndRulesDefaults.labelsExtraHeight;
161
164
  var secondaryMaxItem = 0;
162
165
  var secondaryMinItem = 0;
163
166
  if (lineConfig.isSecondary) {
@@ -233,13 +236,13 @@ export var useBarChart = function (props) {
233
236
  });
234
237
  }
235
238
  var valuesRange = maxItem - minPositiveItem; // Diff bw largest & smallest +ve values
236
- var showFractionalValues = (_5 = props.showFractionalValues) !== null && _5 !== void 0 ? _5 : valuesRange <= 1;
237
- var roundToDigits = (_6 = props.roundToDigits) !== null && _6 !== void 0 ? _6 : (showFractionalValues ? indexOfFirstNonZeroDigit(valuesRange) + 1 : 0);
239
+ var showFractionalValues = (_13 = props.showFractionalValues) !== null && _13 !== void 0 ? _13 : valuesRange <= 1;
240
+ var roundToDigits = (_14 = props.roundToDigits) !== null && _14 !== void 0 ? _14 : (showFractionalValues ? indexOfFirstNonZeroDigit(valuesRange) + 1 : 0);
238
241
  var maxAndMin = maxAndMinUtil(maxItem, minItem, roundToDigits, showFractionalValues);
239
242
  var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxAndMin.maxItem) || 10;
240
243
  var secondaryRange = secondaryMaxItem - secondaryMinPositiveItem; // Diff bw largest & smallest +ve values
241
- var showSecondaryFractionalValues = (_8 = (_7 = props.secondaryYAxis) === null || _7 === void 0 ? void 0 : _7.showFractionalValues) !== null && _8 !== void 0 ? _8 : secondaryRange <= 1;
242
- var secondaryRoundToDigits = (_10 = (_9 = props.secondaryYAxis) === null || _9 === void 0 ? void 0 : _9.roundToDigits) !== null && _10 !== void 0 ? _10 : (showSecondaryFractionalValues
244
+ var showSecondaryFractionalValues = (_16 = (_15 = props.secondaryYAxis) === null || _15 === void 0 ? void 0 : _15.showFractionalValues) !== null && _16 !== void 0 ? _16 : secondaryRange <= 1;
245
+ var secondaryRoundToDigits = (_18 = (_17 = props.secondaryYAxis) === null || _17 === void 0 ? void 0 : _17.roundToDigits) !== null && _18 !== void 0 ? _18 : (showSecondaryFractionalValues
243
246
  ? indexOfFirstNonZeroDigit(secondaryRange) + 1
244
247
  : 0);
245
248
  var secondaryMaxAndMin = maxAndMinUtil(secondaryMaxItem, secondaryMinItem, secondaryRoundToDigits, showSecondaryFractionalValues);
@@ -249,88 +252,88 @@ export var useBarChart = function (props) {
249
252
  // secondaryMaxAndMin.maxItem
250
253
  // : secondaryMaxAndMin.maxItem
251
254
  // : maxValue
252
- var secondaryMaxValue = (_12 = (_11 = props.secondaryYAxis) === null || _11 === void 0 ? void 0 : _11.maxValue) !== null && _12 !== void 0 ? _12 : secondaryMaxAndMin.maxItem;
255
+ var secondaryMaxValue = getMaxValue((_19 = props.secondaryYAxis) === null || _19 === void 0 ? void 0 : _19.maxValue, (_20 = props.secondaryYAxis) === null || _20 === void 0 ? void 0 : _20.stepValue, secondaryNoOfSections, secondaryMaxAndMin.maxItem);
253
256
  var mostNegativeValue = getMostNegativeValue(props.mostNegativeValue, props.negativeStepValue, props.noOfSectionsBelowXAxis, maxAndMin.minItem);
254
- var stepValue = (_13 = props.stepValue) !== null && _13 !== void 0 ? _13 : maxValue / noOfSections;
257
+ var stepValue = (_21 = props.stepValue) !== null && _21 !== void 0 ? _21 : maxValue / noOfSections;
255
258
  var effectiveNegativeStepValue = negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue;
256
- var noOfSectionsBelowXAxis = (_14 = props.noOfSectionsBelowXAxis) !== null && _14 !== void 0 ? _14 : (effectiveNegativeStepValue
259
+ var noOfSectionsBelowXAxis = (_22 = props.noOfSectionsBelowXAxis) !== null && _22 !== void 0 ? _22 : (effectiveNegativeStepValue
257
260
  ? Math.round(Math.ceil(-mostNegativeValue / effectiveNegativeStepValue))
258
261
  : 0);
259
- var showScrollIndicator = (_15 = props.showScrollIndicator) !== null && _15 !== void 0 ? _15 : BarDefaults.showScrollIndicator;
260
- var side = (_16 = props.side) !== null && _16 !== void 0 ? _16 : BarDefaults.side;
261
- var rotateLabel = (_17 = props.rotateLabel) !== null && _17 !== void 0 ? _17 : AxesAndRulesDefaults.rotateLabel;
262
- var opacity = (_18 = props.opacity) !== null && _18 !== void 0 ? _18 : BarDefaults.opacity;
263
- var isThreeD = (_19 = props.isThreeD) !== null && _19 !== void 0 ? _19 : BarDefaults.isThreeD;
264
- var showXAxisIndices = (_20 = props.showXAxisIndices) !== null && _20 !== void 0 ? _20 : AxesAndRulesDefaults.showXAxisIndices;
265
- var xAxisIndicesHeight = (_21 = props.xAxisIndicesHeight) !== null && _21 !== void 0 ? _21 : AxesAndRulesDefaults.xAxisIndicesHeight;
266
- var xAxisIndicesWidth = (_22 = props.xAxisIndicesWidth) !== null && _22 !== void 0 ? _22 : AxesAndRulesDefaults.xAxisIndicesWidth;
267
- var xAxisIndicesColor = (_23 = props.xAxisIndicesColor) !== null && _23 !== void 0 ? _23 : AxesAndRulesDefaults.xAxisIndicesColor;
268
- var xAxisThickness = (_24 = props.xAxisThickness) !== null && _24 !== void 0 ? _24 : AxesAndRulesDefaults.xAxisThickness;
269
- var xAxisTextNumberOfLines = (_25 = props.xAxisTextNumberOfLines) !== null && _25 !== void 0 ? _25 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
270
- var xAxisLabelsVerticalShift = (_26 = props.xAxisLabelsVerticalShift) !== null && _26 !== void 0 ? _26 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
271
- var xAxisLabelsAtBottom = (_27 = props.xAxisLabelsAtBottom) !== null && _27 !== void 0 ? _27 : false;
262
+ var showScrollIndicator = (_23 = props.showScrollIndicator) !== null && _23 !== void 0 ? _23 : BarDefaults.showScrollIndicator;
263
+ var side = (_24 = props.side) !== null && _24 !== void 0 ? _24 : BarDefaults.side;
264
+ var rotateLabel = (_25 = props.rotateLabel) !== null && _25 !== void 0 ? _25 : AxesAndRulesDefaults.rotateLabel;
265
+ var opacity = (_26 = props.opacity) !== null && _26 !== void 0 ? _26 : BarDefaults.opacity;
266
+ var isThreeD = (_27 = props.isThreeD) !== null && _27 !== void 0 ? _27 : BarDefaults.isThreeD;
267
+ var showXAxisIndices = (_28 = props.showXAxisIndices) !== null && _28 !== void 0 ? _28 : AxesAndRulesDefaults.showXAxisIndices;
268
+ var xAxisIndicesHeight = (_29 = props.xAxisIndicesHeight) !== null && _29 !== void 0 ? _29 : AxesAndRulesDefaults.xAxisIndicesHeight;
269
+ var xAxisIndicesWidth = (_30 = props.xAxisIndicesWidth) !== null && _30 !== void 0 ? _30 : AxesAndRulesDefaults.xAxisIndicesWidth;
270
+ var xAxisIndicesColor = (_31 = props.xAxisIndicesColor) !== null && _31 !== void 0 ? _31 : AxesAndRulesDefaults.xAxisIndicesColor;
271
+ var xAxisThickness = (_32 = props.xAxisThickness) !== null && _32 !== void 0 ? _32 : AxesAndRulesDefaults.xAxisThickness;
272
+ var xAxisTextNumberOfLines = (_33 = props.xAxisTextNumberOfLines) !== null && _33 !== void 0 ? _33 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
273
+ var xAxisLabelsVerticalShift = (_34 = props.xAxisLabelsVerticalShift) !== null && _34 !== void 0 ? _34 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
274
+ var xAxisLabelsAtBottom = (_35 = props.xAxisLabelsAtBottom) !== null && _35 !== void 0 ? _35 : false;
272
275
  var horizontalRulesStyle = props.horizontalRulesStyle;
273
- var autoShiftLabels = (_28 = props.autoShiftLabels) !== null && _28 !== void 0 ? _28 : false;
274
- var barBorderColor = (_29 = props.barBorderColor) !== null && _29 !== void 0 ? _29 : BarDefaults.barBorderColor;
276
+ var autoShiftLabels = (_36 = props.autoShiftLabels) !== null && _36 !== void 0 ? _36 : false;
277
+ var barBorderColor = (_37 = props.barBorderColor) !== null && _37 !== void 0 ? _37 : BarDefaults.barBorderColor;
275
278
  var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
276
279
  var axesAndRulesProps = getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, roundToDigits, negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue, secondaryMaxValue, secondaryMinItem, showSecondaryFractionalValues, secondaryRoundToDigits);
277
- var _75 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepHeight = _75.stepHeight, secondaryStepValue = _75.stepValue, secondaryNegativeStepHeight = _75.negativeStepHeight, secondaryNegativeStepValue = _75.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _75.noOfSectionsBelowXAxis;
278
- var primary4thQuadrantHeight = noOfSectionsBelowXAxis * ((_30 = props.negativeStepHeight) !== null && _30 !== void 0 ? _30 : stepHeight);
280
+ var _85 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepHeight = _85.stepHeight, secondaryStepValue = _85.stepValue, secondaryNegativeStepHeight = _85.negativeStepHeight, secondaryNegativeStepValue = _85.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _85.noOfSectionsBelowXAxis;
281
+ var primary4thQuadrantHeight = noOfSectionsBelowXAxis * ((_38 = props.negativeStepHeight) !== null && _38 !== void 0 ? _38 : stepHeight);
279
282
  var secondary4thQuadrantHeight = secondaryNoOfSectionsBelowXAxis * secondaryNegativeStepHeight;
280
283
  var fourthQuadrantHeight = Math.max(primary4thQuadrantHeight, secondary4thQuadrantHeight);
281
284
  var containerHeightIncludingBelowXAxis = extendedContainerHeight + fourthQuadrantHeight;
282
- var _76 = __read(useState(-1), 2), pointerIndex = _76[0], setPointerIndex = _76[1];
283
- var _77 = __read(useState(0), 2), pointerX = _77[0], setPointerX = _77[1];
284
- var _78 = __read(useState(0), 2), pointerY = _78[0], setPointerY = _78[1];
285
- var _79 = __read(useState(), 2), pointerItem = _79[0], setPointerItem = _79[1];
286
- var _80 = __read(useState(0), 2), responderStartTime = _80[0], setResponderStartTime = _80[1];
287
- var _81 = __read(useState(false), 2), responderActive = _81[0], setResponderActive = _81[1];
285
+ var _86 = __read(useState(-1), 2), pointerIndex = _86[0], setPointerIndex = _86[1];
286
+ var _87 = __read(useState(0), 2), pointerX = _87[0], setPointerX = _87[1];
287
+ var _88 = __read(useState(0), 2), pointerY = _88[0], setPointerY = _88[1];
288
+ var _89 = __read(useState(), 2), pointerItem = _89[0], setPointerItem = _89[1];
289
+ var _90 = __read(useState(0), 2), responderStartTime = _90[0], setResponderStartTime = _90[1];
290
+ var _91 = __read(useState(false), 2), responderActive = _91[0], setResponderActive = _91[1];
288
291
  var pointerConfig = props.pointerConfig;
289
- var getPointerProps = (_31 = props.getPointerProps) !== null && _31 !== void 0 ? _31 : null;
290
- var pointerHeight = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.height;
291
- var pointerWidth = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.width;
292
- var pointerRadius = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _34 !== void 0 ? _34 : defaultPointerConfig.radius;
293
- var pointerColor = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _35 !== void 0 ? _35 : defaultPointerConfig.pointerColor;
294
- var pointerComponent = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.pointerComponent;
292
+ var getPointerProps = (_39 = props.getPointerProps) !== null && _39 !== void 0 ? _39 : null;
293
+ var pointerHeight = (_40 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _40 !== void 0 ? _40 : defaultPointerConfig.height;
294
+ var pointerWidth = (_41 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _41 !== void 0 ? _41 : defaultPointerConfig.width;
295
+ var pointerRadius = (_42 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _42 !== void 0 ? _42 : defaultPointerConfig.radius;
296
+ var pointerColor = (_43 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _43 !== void 0 ? _43 : defaultPointerConfig.pointerColor;
297
+ var pointerComponent = (_44 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _44 !== void 0 ? _44 : defaultPointerConfig.pointerComponent;
295
298
  var showPointerStrip = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.showPointerStrip) === false
296
299
  ? false
297
300
  : defaultPointerConfig.showPointerStrip;
298
- var pointerStripHeight = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.pointerStripHeight;
299
- var pointerStripWidth = (_38 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _38 !== void 0 ? _38 : defaultPointerConfig.pointerStripWidth;
300
- var pointerStripColor = (_39 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _39 !== void 0 ? _39 : defaultPointerConfig.pointerStripColor;
301
- var pointerStripUptoDataPoint = (_40 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _40 !== void 0 ? _40 : defaultPointerConfig.pointerStripUptoDataPoint;
302
- var pointerLabelComponent = (_41 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _41 !== void 0 ? _41 : defaultPointerConfig.pointerLabelComponent;
303
- var stripOverPointer = (_42 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _42 !== void 0 ? _42 : defaultPointerConfig.stripOverPointer;
304
- var shiftPointerLabelX = (_43 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _43 !== void 0 ? _43 : defaultPointerConfig.shiftPointerLabelX;
305
- var shiftPointerLabelY = (_44 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _44 !== void 0 ? _44 : defaultPointerConfig.shiftPointerLabelY;
306
- var pointerLabelWidth = (_45 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _45 !== void 0 ? _45 : defaultPointerConfig.pointerLabelWidth;
307
- var pointerLabelHeight = (_46 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _46 !== void 0 ? _46 : defaultPointerConfig.pointerLabelHeight;
308
- var autoAdjustPointerLabelPosition = (_47 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _47 !== void 0 ? _47 : defaultPointerConfig.autoAdjustPointerLabelPosition;
309
- var pointerVanishDelay = (_48 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _48 !== void 0 ? _48 : defaultPointerConfig.pointerVanishDelay;
310
- var activatePointersOnLongPress = (_49 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _49 !== void 0 ? _49 : defaultPointerConfig.activatePointersOnLongPress;
311
- var activatePointersDelay = (_50 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _50 !== void 0 ? _50 : defaultPointerConfig.activatePointersDelay;
312
- var initialPointerIndex = (_51 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _51 !== void 0 ? _51 : defaultPointerConfig.initialPointerIndex;
313
- var initialPointerAppearDelay = (_52 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _52 !== void 0 ? _52 : (isAnimated
301
+ var pointerStripHeight = (_45 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _45 !== void 0 ? _45 : defaultPointerConfig.pointerStripHeight;
302
+ var pointerStripWidth = (_46 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _46 !== void 0 ? _46 : defaultPointerConfig.pointerStripWidth;
303
+ var pointerStripColor = (_47 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _47 !== void 0 ? _47 : defaultPointerConfig.pointerStripColor;
304
+ var pointerStripUptoDataPoint = (_48 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _48 !== void 0 ? _48 : defaultPointerConfig.pointerStripUptoDataPoint;
305
+ var pointerLabelComponent = (_49 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _49 !== void 0 ? _49 : defaultPointerConfig.pointerLabelComponent;
306
+ var stripOverPointer = (_50 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _50 !== void 0 ? _50 : defaultPointerConfig.stripOverPointer;
307
+ var shiftPointerLabelX = (_51 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _51 !== void 0 ? _51 : defaultPointerConfig.shiftPointerLabelX;
308
+ var shiftPointerLabelY = (_52 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _52 !== void 0 ? _52 : defaultPointerConfig.shiftPointerLabelY;
309
+ var pointerLabelWidth = (_53 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _53 !== void 0 ? _53 : defaultPointerConfig.pointerLabelWidth;
310
+ var pointerLabelHeight = (_54 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _54 !== void 0 ? _54 : defaultPointerConfig.pointerLabelHeight;
311
+ var autoAdjustPointerLabelPosition = (_55 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _55 !== void 0 ? _55 : defaultPointerConfig.autoAdjustPointerLabelPosition;
312
+ var pointerVanishDelay = (_56 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _56 !== void 0 ? _56 : defaultPointerConfig.pointerVanishDelay;
313
+ var activatePointersOnLongPress = (_57 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _57 !== void 0 ? _57 : defaultPointerConfig.activatePointersOnLongPress;
314
+ var activatePointersDelay = (_58 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _58 !== void 0 ? _58 : defaultPointerConfig.activatePointersDelay;
315
+ var initialPointerIndex = (_59 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _59 !== void 0 ? _59 : defaultPointerConfig.initialPointerIndex;
316
+ var initialPointerAppearDelay = (_60 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _60 !== void 0 ? _60 : (isAnimated
314
317
  ? animationDuration
315
318
  : defaultPointerConfig.initialPointerAppearDelay);
316
- var persistPointer = (_53 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _53 !== void 0 ? _53 : defaultPointerConfig.persistPointer;
317
- var hidePointer1 = (_54 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _54 !== void 0 ? _54 : defaultPointerConfig.hidePointer1;
319
+ var persistPointer = (_61 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _61 !== void 0 ? _61 : defaultPointerConfig.persistPointer;
320
+ var hidePointer1 = (_62 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _62 !== void 0 ? _62 : defaultPointerConfig.hidePointer1;
318
321
  var pointerEvents = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerEvents;
319
- var stripBehindBars = (_55 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _55 !== void 0 ? _55 : defaultPointerConfig.stripBehindBars;
320
- var disableScroll = (_56 = props.disableScroll) !== null && _56 !== void 0 ? _56 : (pointerConfig
322
+ var stripBehindBars = (_63 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _63 !== void 0 ? _63 : defaultPointerConfig.stripBehindBars;
323
+ var disableScroll = (_64 = props.disableScroll) !== null && _64 !== void 0 ? _64 : (pointerConfig
321
324
  ? activatePointersOnLongPress
322
325
  ? !!responderActive
323
326
  : true
324
327
  : false);
325
328
  var yAxisExtraHeightAtTop = props.trimYAxisAtTop
326
329
  ? 0
327
- : (_57 = props.yAxisExtraHeight) !== null && _57 !== void 0 ? _57 : containerHeight / 20;
330
+ : (_65 = props.yAxisExtraHeight) !== null && _65 !== void 0 ? _65 : containerHeight / 20;
328
331
  var barInnerComponent = props.barInnerComponent;
329
332
  var localYAxisOffset1 = lineConfig.isSecondary
330
- ? (_59 = (_58 = props.secondaryYAxis) === null || _58 === void 0 ? void 0 : _58.yAxisOffset) !== null && _59 !== void 0 ? _59 : 0
333
+ ? (_67 = (_66 = props.secondaryYAxis) === null || _66 === void 0 ? void 0 : _66.yAxisOffset) !== null && _67 !== void 0 ? _67 : 0
331
334
  : yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
332
335
  var localYAxisOffset2 = lineConfig2.isSecondary
333
- ? (_61 = (_60 = props.secondaryYAxis) === null || _60 === void 0 ? void 0 : _60.yAxisOffset) !== null && _61 !== void 0 ? _61 : 0
336
+ ? (_69 = (_68 = props.secondaryYAxis) === null || _68 === void 0 ? void 0 : _68.yAxisOffset) !== null && _69 !== void 0 ? _69 : 0
334
337
  : yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
335
338
  useEffect(function () {
336
339
  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;
@@ -446,9 +449,9 @@ export var useBarChart = function (props) {
446
449
  spacing,
447
450
  yAxisLabelWidth,
448
451
  lineConfig.showArrow,
449
- (_62 = lineConfig.arrowConfig) === null || _62 === void 0 ? void 0 : _62.length,
450
- (_63 = lineConfig.arrowConfig) === null || _63 === void 0 ? void 0 : _63.width,
451
- (_64 = lineConfig.arrowConfig) === null || _64 === void 0 ? void 0 : _64.showArrowBase
452
+ (_70 = lineConfig.arrowConfig) === null || _70 === void 0 ? void 0 : _70.length,
453
+ (_71 = lineConfig.arrowConfig) === null || _71 === void 0 ? void 0 : _71.width,
454
+ (_72 = lineConfig.arrowConfig) === null || _72 === void 0 ? void 0 : _72.showArrowBase
452
455
  ]);
453
456
  useEffect(function () {
454
457
  var _a, _b;
@@ -585,19 +588,19 @@ export var useBarChart = function (props) {
585
588
  containerHeight: containerHeight,
586
589
  noOfSectionsBelowXAxis: noOfSectionsBelowXAxis,
587
590
  stepHeight: stepHeight,
588
- negativeStepHeight: (_65 = props.negativeStepHeight) !== null && _65 !== void 0 ? _65 : stepHeight,
591
+ negativeStepHeight: (_73 = props.negativeStepHeight) !== null && _73 !== void 0 ? _73 : stepHeight,
589
592
  labelsExtraHeight: labelsExtraHeight,
590
593
  yAxisLabelWidth: yAxisLabelWidth,
591
594
  horizontal: horizontal,
592
595
  rtl: rtl,
593
- shiftX: (_66 = props.shiftX) !== null && _66 !== void 0 ? _66 : 0,
594
- shiftY: (_67 = props.shiftY) !== null && _67 !== void 0 ? _67 : 0,
596
+ shiftX: (_74 = props.shiftX) !== null && _74 !== void 0 ? _74 : 0,
597
+ shiftY: (_75 = props.shiftY) !== null && _75 !== void 0 ? _75 : 0,
595
598
  yAxisAtTop: yAxisAtTop,
596
599
  initialSpacing: initialSpacing,
597
600
  data: data,
598
601
  stackData: stackData,
599
602
  // secondaryData,
600
- barWidth: (_68 = props.barWidth) !== null && _68 !== void 0 ? _68 : defaultBarWidth,
603
+ barWidth: (_76 = props.barWidth) !== null && _76 !== void 0 ? _76 : defaultBarWidth,
601
604
  xAxisThickness: xAxisThickness,
602
605
  totalWidth: totalWidth,
603
606
  disableScroll: disableScroll,
@@ -646,7 +649,7 @@ export var useBarChart = function (props) {
646
649
  pointerY: pointerY,
647
650
  onEndReached: props.onEndReached,
648
651
  onStartReached: props.onStartReached,
649
- endReachedOffset: (_69 = props.endReachedOffset) !== null && _69 !== void 0 ? _69 : BarDefaults.endReachedOffset,
652
+ endReachedOffset: (_77 = props.endReachedOffset) !== null && _77 !== void 0 ? _77 : BarDefaults.endReachedOffset,
650
653
  onMomentumScrollEnd: props.onMomentumScrollEnd,
651
654
  customBackground: props.customBackground,
652
655
  highlightEnabled: highlightEnabled,
@@ -64,7 +64,6 @@ export interface stackDataItem {
64
64
  verticalLineStrokeDashArray?: number[];
65
65
  verticalLineShift?: number;
66
66
  verticalLineZIndex?: number;
67
- noOfVerticalLine?: number;
68
67
  verticalLineSpacing?: number;
69
68
  verticalLineStrokeLinecap?: Linecap;
70
69
  }
@@ -385,6 +384,7 @@ export interface lineConfigType {
385
384
  dataPointsHeight?: number;
386
385
  dataPointsColor?: ColorValue | string | any;
387
386
  dataPointsRadius?: number;
387
+ dataPointLabelComponent?: (item: lineDataItem, index: number) => ReactNode;
388
388
  textColor?: ColorValue | string | any;
389
389
  textFontSize?: number;
390
390
  textShiftX?: number;
@@ -401,7 +401,11 @@ export interface lineConfigType {
401
401
  focusedDataPointColor?: ColorValue;
402
402
  focusedDataPointRadius?: number;
403
403
  focusedDataPointIndex?: number;
404
+ showDataPointLabelOnFocus?: boolean;
404
405
  }
406
+ export type lineConfigWithSetFocusedDataPointIndexType = lineConfigType & {
407
+ setFocusedDataPointIndex: (i: number) => void;
408
+ };
405
409
  export interface defaultLineConfigType {
406
410
  initialSpacing: number;
407
411
  curved: boolean;
@@ -418,6 +422,7 @@ export interface defaultLineConfigType {
418
422
  dataPointsHeight: number;
419
423
  dataPointsColor: ColorValue | string | any;
420
424
  dataPointsRadius: number;
425
+ dataPointLabelComponent?: (item: lineDataItem, index: number) => ReactNode;
421
426
  textColor: ColorValue | string | any;
422
427
  textFontSize: number;
423
428
  textShiftX: number;
@@ -433,6 +438,8 @@ export interface defaultLineConfigType {
433
438
  focusEnabled: boolean;
434
439
  focusedDataPointColor: ColorValue;
435
440
  focusedDataPointRadius: number;
441
+ showDataPointLabelOnFocus: boolean;
442
+ setFocusedDataPointIndex: (i: number) => void;
436
443
  }
437
444
  interface arrowType {
438
445
  length?: number;
@@ -499,7 +506,6 @@ export interface barDataItem {
499
506
  verticalLineStrokeDashArray?: number[];
500
507
  verticalLineShift?: number;
501
508
  verticalLineZIndex?: number;
502
- noOfVerticalLine?: number;
503
509
  verticalLineSpacing?: number;
504
510
  verticalLineStrokeLinecap?: Linecap;
505
511
  }
@@ -1406,20 +1406,30 @@ export var useLineChart = function (props) {
1406
1406
  };
1407
1407
  var pointerItemLocal = [];
1408
1408
  if (pointerConfig) {
1409
- pointerItemLocal = [
1410
- __assign(__assign({}, pointerItem), { value: (_330 = (_329 = props.data) === null || _329 === void 0 ? void 0 : _329[pointerIndex]) === null || _330 === void 0 ? void 0 : _330.value })
1411
- ];
1412
- if (pointerY2 !== 0) {
1413
- pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_332 = (_331 = props.data2) === null || _331 === void 0 ? void 0 : _331[pointerIndex]) === null || _332 === void 0 ? void 0 : _332.value }));
1414
- }
1415
- if (pointerY3 !== 0) {
1416
- pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_334 = (_333 = props.data3) === null || _333 === void 0 ? void 0 : _333[pointerIndex]) === null || _334 === void 0 ? void 0 : _334.value }));
1417
- }
1418
- if (pointerY4 !== 0) {
1419
- pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_336 = (_335 = props.data4) === null || _335 === void 0 ? void 0 : _335[pointerIndex]) === null || _336 === void 0 ? void 0 : _336.value }));
1409
+ if (dataSet) {
1410
+ pointerItemLocal = dataSet.map(function (dataItem) {
1411
+ var _a, _b, _c;
1412
+ return ({
1413
+ value: (_c = (_b = (_a = dataItem === null || dataItem === void 0 ? void 0 : dataItem.data) === null || _a === void 0 ? void 0 : _a[pointerIndex]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : 0
1414
+ });
1415
+ });
1420
1416
  }
1421
- if (pointerY5 !== 0) {
1422
- pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_338 = (_337 = props.data5) === null || _337 === void 0 ? void 0 : _337[pointerIndex]) === null || _338 === void 0 ? void 0 : _338.value }));
1417
+ else {
1418
+ pointerItemLocal = [
1419
+ __assign(__assign({}, pointerItem), { value: (_330 = (_329 = props.data) === null || _329 === void 0 ? void 0 : _329[pointerIndex]) === null || _330 === void 0 ? void 0 : _330.value })
1420
+ ];
1421
+ if (pointerY2 !== 0) {
1422
+ pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_332 = (_331 = props.data2) === null || _331 === void 0 ? void 0 : _331[pointerIndex]) === null || _332 === void 0 ? void 0 : _332.value }));
1423
+ }
1424
+ if (pointerY3 !== 0) {
1425
+ pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_334 = (_333 = props.data3) === null || _333 === void 0 ? void 0 : _333[pointerIndex]) === null || _334 === void 0 ? void 0 : _334.value }));
1426
+ }
1427
+ if (pointerY4 !== 0) {
1428
+ pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_336 = (_335 = props.data4) === null || _335 === void 0 ? void 0 : _335[pointerIndex]) === null || _336 === void 0 ? void 0 : _336.value }));
1429
+ }
1430
+ if (pointerY5 !== 0) {
1431
+ pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_338 = (_337 = props.data5) === null || _337 === void 0 ? void 0 : _337[pointerIndex]) === null || _338 === void 0 ? void 0 : _338.value }));
1432
+ }
1423
1433
  }
1424
1434
  }
1425
1435
  return {
@@ -388,7 +388,6 @@ export interface lineDataItem {
388
388
  verticalLineStrokeDashArray?: number[];
389
389
  verticalLineShift?: number;
390
390
  verticalLineZIndex?: number;
391
- noOfVerticalLine?: number;
392
391
  verticalLineSpacing?: number;
393
392
  verticalLineStrokeLinecap?: Linecap;
394
393
  pointerShiftX?: number;
@@ -45,6 +45,7 @@ interface IusePieChart {
45
45
  fontStyle: any;
46
46
  tooltipSelectedIndex: number;
47
47
  setTooltipSelectedIndex: any;
48
+ rotatable: boolean;
48
49
  }
49
50
  interface IPieChartPropsType extends PieChartPropsType {
50
51
  pro?: boolean;
@@ -18,10 +18,10 @@ import { useEffect, useState } from 'react';
18
18
  import { getTextSizeForPieLabels } from '../utils';
19
19
  import { PieTooltipDefaults } from '../utils/constants';
20
20
  export var usePieChart = function (props) {
21
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
22
- var showTooltip = props.showTooltip, tooltipWidth = props.tooltipWidth, tooltipComponent = props.tooltipComponent, _w = props.tooltipVerticalShift, tooltipVerticalShift = _w === void 0 ? PieTooltipDefaults.tooltipVerticalShift : _w, _x = props.tooltipHorizontalShift, tooltipHorizontalShift = _x === void 0 ? PieTooltipDefaults.tooltipHorizontalShift : _x, _y = props.showValuesAsTooltipText, showValuesAsTooltipText = _y === void 0 ? PieTooltipDefaults.showValuesAsTooltipText : _y, _z = props.tooltipTextNoOfLines, tooltipTextNoOfLines = _z === void 0 ? PieTooltipDefaults.tooltipTextNoOfLines : _z, _0 = props.tooltipBackgroundColor, tooltipBackgroundColor = _0 === void 0 ? PieTooltipDefaults.tooltipBackgroundColor : _0, _1 = props.tooltipBorderRadius, tooltipBorderRadius = _1 === void 0 ? PieTooltipDefaults.tooltipBorderRadius : _1, textColor = props.textColor,
21
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
22
+ var showTooltip = props.showTooltip, tooltipWidth = props.tooltipWidth, tooltipComponent = props.tooltipComponent, _v = props.tooltipVerticalShift, tooltipVerticalShift = _v === void 0 ? PieTooltipDefaults.tooltipVerticalShift : _v, _w = props.tooltipHorizontalShift, tooltipHorizontalShift = _w === void 0 ? PieTooltipDefaults.tooltipHorizontalShift : _w, _x = props.showValuesAsTooltipText, showValuesAsTooltipText = _x === void 0 ? PieTooltipDefaults.showValuesAsTooltipText : _x, _y = props.tooltipTextNoOfLines, tooltipTextNoOfLines = _y === void 0 ? PieTooltipDefaults.tooltipTextNoOfLines : _y, _z = props.tooltipBackgroundColor, tooltipBackgroundColor = _z === void 0 ? PieTooltipDefaults.tooltipBackgroundColor : _z, _0 = props.tooltipBorderRadius, tooltipBorderRadius = _0 === void 0 ? PieTooltipDefaults.tooltipBorderRadius : _0, textColor = props.textColor,
23
23
  // textSize,
24
- font = props.font, fontWeight = props.fontWeight, fontStyle = props.fontStyle;
24
+ font = props.font, fontWeight = props.fontWeight, fontStyle = props.fontStyle, initialAngle = props.initialAngle, _1 = props.rotatable, rotatable = _1 === void 0 ? false : _1;
25
25
  var _2 = __read(useState(-1), 2), tooltipSelectedIndex = _2[0], setTooltipSelectedIndex = _2[1];
26
26
  var radius = (_a = props.radius) !== null && _a !== void 0 ? _a : 120;
27
27
  var extraRadius = (_b = props.extraRadius) !== null && _b !== void 0 ? _b : (props.showExternalLabels
@@ -32,25 +32,26 @@ export var usePieChart = function (props) {
32
32
  var pi = props.semiCircle ? Math.PI / 2 : Math.PI;
33
33
  var _3 = __read(useState((_d = props.focusedPieIndex) !== null && _d !== void 0 ? _d : -1), 2), selectedIndex = _3[0], setSelectedIndex = _3[1]; // at the start, nothing is selected
34
34
  // because we're going to use a useEffect, we need startAngle and total to be state variables
35
- var _4 = __read(useState((_e = props.initialAngle) !== null && _e !== void 0 ? _e : (props.semiCircle ? -pi : 0)), 2), startAngle = _4[0], setStartAngle = _4[1];
35
+ var _4 = __read(useState(initialAngle !== null && initialAngle !== void 0 ? initialAngle : (props.semiCircle ? -pi : 0)), 2), startAngle = _4[0], setStartAngle = _4[1];
36
36
  var _5 = __read(useState(0), 2), total = _5[0], setTotal = _5[1];
37
37
  useEffect(function () {
38
38
  var _a;
39
39
  setSelectedIndex((_a = props.focusedPieIndex) !== null && _a !== void 0 ? _a : -1);
40
40
  }, [props.focusedPieIndex]);
41
41
  useEffect(function () {
42
- var _a;
43
42
  // Update the total, this could be use to replace the forEach : const newTotal = props.data.reduce((acc, item) => acc + item.value, 0);
44
43
  var newTotal = 0;
45
- props.data.forEach(function (item) {
44
+ props.data.forEach(function (item, index) {
46
45
  newTotal += item.value;
46
+ if (index === props.focusedPieIndex)
47
+ item.focused = true;
47
48
  });
48
49
  setTotal(newTotal);
49
50
  // Update selectedIndex based on focused item
50
51
  var newSelectedIndex = props.data.findIndex(function (item) { return item.focused === true; });
51
52
  setSelectedIndex(newSelectedIndex);
52
53
  // Calculate the new start angle
53
- var newStartAngle = (_a = props.initialAngle) !== null && _a !== void 0 ? _a : (props.semiCircle ? -pi : 0);
54
+ var newStartAngle = initialAngle !== null && initialAngle !== void 0 ? initialAngle : (props.semiCircle ? -pi : 0);
54
55
  if (newSelectedIndex !== -1) {
55
56
  // it was !== 0 here before, which would not work, it's either !==-1 or >=0
56
57
  // This could be used to replace the for loop that was used before
@@ -62,11 +63,10 @@ export var usePieChart = function (props) {
62
63
  else {
63
64
  setStartAngle(newStartAngle);
64
65
  }
65
- }, [props.data, props.initialAngle, props.semiCircle]);
66
+ }, [props.data, initialAngle, props.semiCircle]);
66
67
  useEffect(function () {
67
- var _a;
68
68
  if (selectedIndex !== -1) {
69
- var newStartAngle = (_a = props.initialAngle) !== null && _a !== void 0 ? _a : (props.semiCircle ? -pi : 0);
69
+ var newStartAngle = initialAngle !== null && initialAngle !== void 0 ? initialAngle : (props.semiCircle ? -pi : 0);
70
70
  var start = 0;
71
71
  for (var i = 0; i < selectedIndex; i++) {
72
72
  start += props.data[i].value;
@@ -77,29 +77,29 @@ export var usePieChart = function (props) {
77
77
  }
78
78
  }, [selectedIndex]);
79
79
  var pro = props.pro, data = props.data, donut = props.donut, isThreeD = props.isThreeD, semiCircle = props.semiCircle, _6 = props.inwardExtraLengthForFocused, inwardExtraLengthForFocused = _6 === void 0 ? 0 : _6, _7 = props.isAnimated, isAnimated = _7 === void 0 ? false : _7, edgesRadius = props.edgesRadius;
80
- var endAngle = (_f = props.endAngle) !== null && _f !== void 0 ? _f : startAngle + Math.PI * (semiCircle ? 1 : 2);
80
+ var endAngle = (_e = props.endAngle) !== null && _e !== void 0 ? _e : startAngle + Math.PI * (semiCircle ? 1 : 2);
81
81
  var canvasWidth = radius * 2;
82
82
  var canvasHeight = isThreeD ? radius * 2.3 : radius * 2;
83
- var strokeWidth = (_g = props.strokeWidth) !== null && _g !== void 0 ? _g : 0;
84
- var innerRadius = (_h = props.innerRadius) !== null && _h !== void 0 ? _h : radius / 2.5;
85
- var innerCircleColor = (_k = (_j = props.innerCircleColor) !== null && _j !== void 0 ? _j : props.backgroundColor) !== null && _k !== void 0 ? _k : 'white';
86
- var innerCircleBorderWidth = (_l = props.innerCircleBorderWidth) !== null && _l !== void 0 ? _l : (props.innerCircleBorderColor ? strokeWidth || 2 : 0);
87
- var innerCircleBorderColor = (_m = props.innerCircleBorderColor) !== null && _m !== void 0 ? _m : 'lightgray';
88
- var shiftInnerCenterX = (_o = props.shiftInnerCenterX) !== null && _o !== void 0 ? _o : 0;
89
- var shiftInnerCenterY = (_p = props.shiftInnerCenterY) !== null && _p !== void 0 ? _p : 0;
90
- var tiltAngle = (_q = props.tiltAngle) !== null && _q !== void 0 ? _q : '55deg';
83
+ var strokeWidth = (_f = props.strokeWidth) !== null && _f !== void 0 ? _f : 0;
84
+ var innerRadius = (_g = props.innerRadius) !== null && _g !== void 0 ? _g : radius / 2.5;
85
+ var innerCircleColor = (_j = (_h = props.innerCircleColor) !== null && _h !== void 0 ? _h : props.backgroundColor) !== null && _j !== void 0 ? _j : 'white';
86
+ var innerCircleBorderWidth = (_k = props.innerCircleBorderWidth) !== null && _k !== void 0 ? _k : (props.innerCircleBorderColor ? strokeWidth || 2 : 0);
87
+ var innerCircleBorderColor = (_l = props.innerCircleBorderColor) !== null && _l !== void 0 ? _l : 'lightgray';
88
+ var shiftInnerCenterX = (_m = props.shiftInnerCenterX) !== null && _m !== void 0 ? _m : 0;
89
+ var shiftInnerCenterY = (_o = props.shiftInnerCenterY) !== null && _o !== void 0 ? _o : 0;
90
+ var tiltAngle = (_p = props.tiltAngle) !== null && _p !== void 0 ? _p : '55deg';
91
91
  var isDataShifted = false;
92
92
  data.forEach(function (item) {
93
93
  if (item.shiftX || item.shiftY) {
94
94
  isDataShifted = true;
95
95
  }
96
96
  });
97
- var textSize = getTextSizeForPieLabels((_r = props.textSize) !== null && _r !== void 0 ? _r : 0, radius);
98
- var paddingHorizontal = ((_s = props.paddingHorizontal) !== null && _s !== void 0 ? _s : props.labelsPosition === 'onBorder')
99
- ? ((_t = props.textBackgroundRadius) !== null && _t !== void 0 ? _t : textSize) * 2 + 6
97
+ var textSize = getTextSizeForPieLabels((_q = props.textSize) !== null && _q !== void 0 ? _q : 0, radius);
98
+ var paddingHorizontal = ((_r = props.paddingHorizontal) !== null && _r !== void 0 ? _r : props.labelsPosition === 'onBorder')
99
+ ? ((_s = props.textBackgroundRadius) !== null && _s !== void 0 ? _s : textSize) * 2 + 6
100
100
  : 0;
101
- var paddingVertical = ((_u = props.paddingVertical) !== null && _u !== void 0 ? _u : props.labelsPosition === 'onBorder')
102
- ? ((_v = props.textBackgroundRadius) !== null && _v !== void 0 ? _v : textSize) * 2 + 6
101
+ var paddingVertical = ((_t = props.paddingVertical) !== null && _t !== void 0 ? _t : props.labelsPosition === 'onBorder')
102
+ ? ((_u = props.textBackgroundRadius) !== null && _u !== void 0 ? _u : textSize) * 2 + 6
103
103
  : 0;
104
104
  var getTooltipText = function (index) {
105
105
  var _a, _b;
@@ -151,6 +151,7 @@ export var usePieChart = function (props) {
151
151
  fontWeight: fontWeight,
152
152
  fontStyle: fontStyle,
153
153
  tooltipSelectedIndex: tooltipSelectedIndex,
154
- setTooltipSelectedIndex: setTooltipSelectedIndex
154
+ setTooltipSelectedIndex: setTooltipSelectedIndex,
155
+ rotatable: rotatable
155
156
  };
156
157
  };
@@ -42,7 +42,7 @@ export var getPieChartMainProps = function (props) {
42
42
  var isThreeD = props.isThreeD, isBiggerPie = props.isBiggerPie, paddingHorizontal = props.paddingHorizontal, paddingVertical = props.paddingVertical, extraRadius = props.extraRadius, showExternalLabels = props.showExternalLabels, externalLabelComponent = props.externalLabelComponent, showTooltip = props.showTooltip, tooltipWidth = props.tooltipWidth, persistTooltip = props.persistTooltip, tooltipComponent = props.tooltipComponent, _13 = props.tooltipDuration, tooltipDuration = _13 === void 0 ? PieTooltipDefaults.tooltipDuration : _13, _14 = props.tooltipVerticalShift, tooltipVerticalShift = _14 === void 0 ? PieTooltipDefaults.tooltipVerticalShift : _14, _15 = props.tooltipHorizontalShift, tooltipHorizontalShift = _15 === void 0 ? PieTooltipDefaults.tooltipHorizontalShift : _15, _16 = props.showValuesAsTooltipText, showValuesAsTooltipText = _16 === void 0 ? PieTooltipDefaults.showValuesAsTooltipText : _16, _17 = props.tooltipTextNoOfLines, tooltipTextNoOfLines = _17 === void 0 ? PieTooltipDefaults.tooltipTextNoOfLines : _17, _18 = props.tooltipBackgroundColor, tooltipBackgroundColor = _18 === void 0 ? PieTooltipDefaults.tooltipBackgroundColor : _18, _19 = props.tooltipBorderRadius, tooltipBorderRadius = _19 === void 0 ? PieTooltipDefaults.tooltipBorderRadius : _19, font = props.font, fontWeight = props.fontWeight, fontStyle = props.fontStyle, edgesPressable = props.edgesPressable, tooltipSelectedIndex = props.tooltipSelectedIndex, setTooltipSelectedIndex = props.setTooltipSelectedIndex;
43
43
  var propData = props.data;
44
44
  var data = [];
45
- var minisculeDataItem = props.data.map(function (item) { return item.value; }).reduce(function (v, a) { return v + a; }) / 160000;
45
+ var minisculeDataItem = props.data.map(function (item) { return item.value; }).reduce(function (v, a) { return v + a; }, 0) / 160000;
46
46
  var itemHasInnerComponent = false;
47
47
  if (propData) {
48
48
  for (var i = 0; i < propData.length; i++) {
@@ -132,7 +132,7 @@ export var getPieChartMainProps = function (props) {
132
132
  var cy = radius;
133
133
  total =
134
134
  data && data.length > 0
135
- ? data.map(function (item) { return item.value; }).reduce(function (v, a) { return v + a; })
135
+ ? data.map(function (item) { return item.value; }).reduce(function (v, a) { return v + a; }, 0)
136
136
  : 0;
137
137
  var acc = 0;
138
138
  var pData = data.map(function (item) {
@@ -26,8 +26,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
26
26
  import { defaultAnimationDuration } from '../utils/constants';
27
27
  export var usePiePro = function (props) {
28
28
  var _a, _b;
29
- var data = props.data, isAnimated = props.isAnimated, donut = props.donut, semiCircle = props.semiCircle, _c = props.radius, radius = _c === void 0 ? 120 : _c, _d = props.innerRadius, innerRadius = _d === void 0 ? donut ? radius / 2.5 : 0 : _d, _e = props.strokeWidth, strokeWidth = _e === void 0 ? props.ring ? 10 : 0 : _e, _f = props.edgesRadius, edgesRadius = _f === void 0 ? 0 : _f, _g = props.startAngle, startAngle = _g === void 0 ? 0 : _g, ring = props.ring;
30
- var endAngle = (_a = props.endAngle) !== null && _a !== void 0 ? _a : startAngle + Math.PI * (semiCircle ? 1 : 2);
29
+ var data = props.data, isAnimated = props.isAnimated, donut = props.donut, semiCircle = props.semiCircle, _c = props.radius, radius = _c === void 0 ? 120 : _c, _d = props.innerRadius, innerRadius = _d === void 0 ? donut ? radius / 2.5 : 0 : _d, _e = props.strokeWidth, strokeWidth = _e === void 0 ? props.ring ? 10 : 0 : _e, _f = props.edgesRadius, edgesRadius = _f === void 0 ? 0 : _f, _g = props.initialAngle, initialAngle = _g === void 0 ? 0 : _g, ring = props.ring;
30
+ var endAngle = (_a = props.endAngle) !== null && _a !== void 0 ? _a : initialAngle + Math.PI * (semiCircle ? 1 : 2);
31
31
  var total = data.reduce(function (acc, item) { return acc + (item === null || item === void 0 ? void 0 : item.value); }, 0);
32
32
  var animationDuration = (_b = props.animationDuration) !== null && _b !== void 0 ? _b : defaultAnimationDuration;
33
33
  var maxStrokeWidth = Math.max.apply(Math, __spreadArray(__spreadArray([], __read(data.map(function (item) { var _a; return (_a = item.strokeWidth) !== null && _a !== void 0 ? _a : 0; })), false), [strokeWidth], false));
@@ -56,7 +56,7 @@ export var usePiePro = function (props) {
56
56
  var getCoordinates = function (index, additionalValue, addInOnlyStart, addInOnlyEnd, totalParam) {
57
57
  var _a;
58
58
  var addedValue = addValues(index - 1) + (addInOnlyEnd ? 0 : additionalValue !== null && additionalValue !== void 0 ? additionalValue : 0);
59
- var angle = (addedValue / (totalParam !== null && totalParam !== void 0 ? totalParam : total)) * endAngle + startAngle;
59
+ var angle = (addedValue / (totalParam !== null && totalParam !== void 0 ? totalParam : total)) * endAngle + initialAngle;
60
60
  var startInnerX = radius + Math.cos(angle) * innerRadius;
61
61
  var startInnerY = radius - Math.sin(angle) * innerRadius;
62
62
  var startOuterX = radius + Math.cos(angle) * radius;
@@ -64,7 +64,7 @@ export var usePiePro = function (props) {
64
64
  var value = addValues(index - 1) +
65
65
  ((_a = data[index]) === null || _a === void 0 ? void 0 : _a.value) +
66
66
  (addInOnlyStart ? 0 : additionalValue !== null && additionalValue !== void 0 ? additionalValue : 0);
67
- angle = (value / (totalParam !== null && totalParam !== void 0 ? totalParam : total)) * endAngle + startAngle;
67
+ angle = (value / (totalParam !== null && totalParam !== void 0 ? totalParam : total)) * endAngle + initialAngle;
68
68
  var endOuterX = radius + Math.cos(angle) * radius;
69
69
  var endOuterY = radius - Math.sin(angle) * radius;
70
70
  var endInnerX = radius + Math.cos(angle) * innerRadius;
@@ -83,7 +83,7 @@ export var usePiePro = function (props) {
83
83
  var getTextCoordinates = function (index, labelPos) {
84
84
  var _a;
85
85
  var value = addValues(index - 1) + ((_a = data[index]) === null || _a === void 0 ? void 0 : _a.value) / 2;
86
- var angle = (value / total) * endAngle + startAngle;
86
+ var angle = (value / total) * endAngle + initialAngle;
87
87
  var labelPosition = labelPos || labelsPosition;
88
88
  var x = radius +
89
89
  Math.cos(angle) *
@@ -62,7 +62,6 @@ export interface PieChartPropsType {
62
62
  pieInnerComponentWidth?: number;
63
63
  paddingHorizontal?: number;
64
64
  paddingVertical?: number;
65
- startAngle?: number;
66
65
  endAngle?: number;
67
66
  curvedStartEdges?: boolean;
68
67
  curvedEndEdges?: boolean;
@@ -77,6 +76,7 @@ export interface PieChartPropsType {
77
76
  * @description If true, the edges of the pie will be pressable, but you may need to press twice for focus- once for unfocusing the already focused pie and then for focusing the new pie
78
77
  */
79
78
  edgesPressable?: boolean;
79
+ rotatable?: boolean;
80
80
  }
81
81
  export interface pieDataItem {
82
82
  value: number;
@@ -60,7 +60,8 @@ export var usePopulationPyramid = function (props) {
60
60
  : height;
61
61
  var stepHeight = (_s = props.stepHeight) !== null && _s !== void 0 ? _s : containerHeight / noOfSections;
62
62
  var xAxisLabelsHeight = 30;
63
- var containerHeightWithXaxisLabels = containerHeight + xAxisLabelsHeight + Math.max(0, xAxisLabelShiftY);
63
+ var additionalHeightForShift = Math.max(0, xAxisLabelShiftY || 0);
64
+ var containerHeightWithXaxisLabels = containerHeight + xAxisLabelsHeight + additionalHeightForShift;
64
65
  var mid = (width + yAxisLabelWidth) / 2;
65
66
  var leftMax = Math.max.apply(Math, __spreadArray([], __read(data.map(function (item) { return item.left; })), false));
66
67
  var rightMax = Math.max.apply(Math, __spreadArray([], __read(data.map(function (item) { return item.right; })), false));
@@ -44,7 +44,6 @@ export declare const useBarAndLineChartsWrapper: (props: BarAndLineChartsWrapper
44
44
  verticalLineStrokeDashArray: any;
45
45
  verticalLineShift: any;
46
46
  verticalLineZIndex: any;
47
- noOfVerticalLine: any;
48
47
  verticalLineSpacing: any;
49
48
  verticalLineStrokeLinecap: any;
50
49
  }[];
@@ -99,7 +99,7 @@ export var useBarAndLineChartsWrapper = function (props) {
99
99
  var secondaryXAxis = axesAndRulesProps.secondaryXAxis;
100
100
  var verticalLinesAr = noOfVerticalLines
101
101
  ? __spreadArray([], __read(Array(noOfVerticalLines).keys()), false) : (stackData !== null && stackData !== void 0 ? stackData : data).map(function (item) {
102
- var showVerticalLine = item.showVerticalLine, verticalLineThickness = item.verticalLineThickness, verticalLineHeight = item.verticalLineHeight, verticalLineColor = item.verticalLineColor, verticalLineStrokeDashArray = item.verticalLineStrokeDashArray, verticalLineShift = item.verticalLineShift, verticalLineZIndex = item.verticalLineZIndex, noOfVerticalLine = item.noOfVerticalLine, verticalLineSpacing = item.verticalLineSpacing, verticalLineStrokeLinecap = item.verticalLineStrokeLinecap;
102
+ var showVerticalLine = item.showVerticalLine, verticalLineThickness = item.verticalLineThickness, verticalLineHeight = item.verticalLineHeight, verticalLineColor = item.verticalLineColor, verticalLineStrokeDashArray = item.verticalLineStrokeDashArray, verticalLineShift = item.verticalLineShift, verticalLineZIndex = item.verticalLineZIndex, verticalLineSpacing = item.verticalLineSpacing, verticalLineStrokeLinecap = item.verticalLineStrokeLinecap;
103
103
  return {
104
104
  showVerticalLine: showVerticalLine,
105
105
  verticalLineThickness: verticalLineThickness,
@@ -108,7 +108,6 @@ export var useBarAndLineChartsWrapper = function (props) {
108
108
  verticalLineStrokeDashArray: verticalLineStrokeDashArray,
109
109
  verticalLineShift: verticalLineShift,
110
110
  verticalLineZIndex: verticalLineZIndex,
111
- noOfVerticalLine: noOfVerticalLine,
112
111
  verticalLineSpacing: verticalLineSpacing,
113
112
  verticalLineStrokeLinecap: verticalLineStrokeLinecap
114
113
  };
@@ -216,7 +216,9 @@ export var defaultLineConfig = {
216
216
  isSecondary: false,
217
217
  focusEnabled: false,
218
218
  focusedDataPointColor: LineDefaults.focusedDataPointColor,
219
- focusedDataPointRadius: LineDefaults.dataPointsRadius
219
+ focusedDataPointRadius: LineDefaults.dataPointsRadius,
220
+ showDataPointLabelOnFocus: LineDefaults.showDataPointLabelOnFocus,
221
+ setFocusedDataPointIndex: function () { }
220
222
  };
221
223
  export var defaultPointerConfig = {
222
224
  height: 0,
@@ -258,14 +260,14 @@ export var defaultPointerConfig = {
258
260
  };
259
261
  // Pie chart specific
260
262
  export var pieColors = [
261
- 'cyan',
262
- 'green',
263
- 'orange',
264
- 'purple',
265
- '#bbff00',
266
- 'red',
267
- 'blue',
268
- 'pink'
263
+ '#ccc',
264
+ '#888',
265
+ '#bbb',
266
+ '#777',
267
+ '#aaa',
268
+ '#666',
269
+ '#999',
270
+ '#555'
269
271
  ];
270
272
  export var populationDefaults = {
271
273
  height: 200,
@@ -1,7 +1,7 @@
1
1
  import { type ColorValue } from 'react-native';
2
2
  import { lineDataItemNullSafe, type IDataSanitisationProps, type lineDataItem } from '../LineChart/types';
3
3
  import { type arrowConfigType, CurveType, type HighlightedRange, type LineProperties, type LineSegment, Framework, referenceConfigType, secondaryYAxisType } from './types';
4
- import { type lineConfigType, type BarChartPropsType, type FocusedBarConfig, type barDataItem, barDataItemNullSafe } from '../BarChart/types';
4
+ import { type lineConfigType, type BarChartPropsType, type FocusedBarConfig, type barDataItem, barDataItemNullSafe, lineConfigWithSetFocusedDataPointIndexType } from '../BarChart/types';
5
5
  import { type extendedLineChartPropsType } from '../LineChart';
6
6
  import { type extendedBarChartPropsType } from '../BarChart';
7
7
  export declare const getCumulativeWidth: (data: any, index: number, spacing: number) => number;
@@ -93,7 +93,7 @@ export declare const getLabelTextUtil: (val: string, index: number, showFraction
93
93
  export declare const getXForLineInBar: (index: number, firstBarWidth: number, currentBarWidth: number, yAxisLabelWidth: number, lineConfig: any, spacing: number) => number;
94
94
  export declare const getYForLineInBar: (value: number | undefined, shiftY: number | undefined, containerHeight: number, maxValue: number, yAxisOffset: number) => number;
95
95
  export declare const clone: (obj: any) => any;
96
- export declare const getLineConfigForBarChart: (lineConfig: lineConfigType, barInitialSpacing: number) => lineConfigType;
96
+ export declare const getLineConfigForBarChart: (lineConfig: lineConfigType, barInitialSpacing: number, focusedDataPointIndex: number, setFocusedDataPointIndex: (i: number) => void) => lineConfigWithSetFocusedDataPointIndexType;
97
97
  export declare const getNoOfSections: (noOfSections: number | undefined, maxValue: number | undefined, stepValue: number | undefined) => number;
98
98
  export declare const getMaxValue: (maxValue: number | undefined, stepValue: number | undefined, noOfSections: number, maxItem: number) => number;
99
99
  export declare const getMostNegativeValue: (minValue: number | undefined, stepValue: number | undefined, noOfSections: number | undefined, minItem: number) => number;
@@ -795,8 +795,8 @@ export var clone = function (obj) {
795
795
  }
796
796
  return temp;
797
797
  };
798
- export var getLineConfigForBarChart = function (lineConfig, barInitialSpacing) {
799
- 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;
798
+ export var getLineConfigForBarChart = function (lineConfig, barInitialSpacing, focusedDataPointIndex, setFocusedDataPointIndex) {
799
+ 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;
800
800
  return {
801
801
  initialSpacing: (_b = (_a = lineConfig.initialSpacing) !== null && _a !== void 0 ? _a : barInitialSpacing) !== null && _b !== void 0 ? _b : defaultLineConfig.initialSpacing,
802
802
  spacing: lineConfig.spacing,
@@ -814,6 +814,7 @@ export var getLineConfigForBarChart = function (lineConfig, barInitialSpacing) {
814
814
  dataPointsWidth: (_p = lineConfig.dataPointsWidth) !== null && _p !== void 0 ? _p : defaultLineConfig.dataPointsWidth,
815
815
  dataPointsColor: (_q = lineConfig.dataPointsColor) !== null && _q !== void 0 ? _q : defaultLineConfig.dataPointsColor,
816
816
  dataPointsRadius: (_r = lineConfig.dataPointsRadius) !== null && _r !== void 0 ? _r : defaultLineConfig.dataPointsRadius,
817
+ dataPointLabelComponent: lineConfig.dataPointLabelComponent,
817
818
  textColor: (_s = lineConfig.textColor) !== null && _s !== void 0 ? _s : defaultLineConfig.textColor,
818
819
  textFontSize: (_t = lineConfig.textFontSize) !== null && _t !== void 0 ? _t : defaultLineConfig.textFontSize,
819
820
  textShiftX: (_u = lineConfig.textShiftX) !== null && _u !== void 0 ? _u : defaultLineConfig.textShiftX,
@@ -839,7 +840,9 @@ export var getLineConfigForBarChart = function (lineConfig, barInitialSpacing) {
839
840
  focusEnabled: (_21 = lineConfig.focusEnabled) !== null && _21 !== void 0 ? _21 : defaultLineConfig.focusEnabled,
840
841
  focusedDataPointColor: (_22 = lineConfig.focusedDataPointColor) !== null && _22 !== void 0 ? _22 : defaultLineConfig.focusedDataPointColor,
841
842
  focusedDataPointRadius: (_23 = lineConfig.focusedDataPointRadius) !== null && _23 !== void 0 ? _23 : defaultLineConfig.focusedDataPointRadius,
842
- focusedDataPointIndex: lineConfig.focusedDataPointIndex
843
+ focusedDataPointIndex: focusedDataPointIndex,
844
+ setFocusedDataPointIndex: setFocusedDataPointIndex,
845
+ showDataPointLabelOnFocus: (_24 = lineConfig.showDataPointLabelOnFocus) !== null && _24 !== void 0 ? _24 : defaultLineConfig.showDataPointLabelOnFocus
843
846
  };
844
847
  };
845
848
  export var getNoOfSections = function (noOfSections, maxValue, stepValue) {
@@ -132,6 +132,7 @@ export interface ExtendedLineConfigType extends lineConfigType {
132
132
  startIndex: number;
133
133
  endIndex: number;
134
134
  dataPointsHeight: number;
135
+ setFocusedDataPointIndex: (i: number) => void;
135
136
  }
136
137
  export interface LineInBarChartPropsType {
137
138
  yAxisLabelWidth: number;
@@ -169,6 +170,8 @@ export interface DataPointProps {
169
170
  selectedIndex: number;
170
171
  yAxisOffset: number;
171
172
  opacity: number;
173
+ svgHeight: number;
174
+ totalWidth: number;
172
175
  }
173
176
  export interface referenceConfigType {
174
177
  thickness?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.70",
3
+ "version": "0.1.72",
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": [