gifted-charts-core 0.1.33 → 0.1.35

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,7 +1,7 @@
1
- import { type lineConfigType, type BarChartPropsType, type barDataItem, type stackDataItem } from './types';
1
+ import { type lineConfigType, type barDataItem, type stackDataItem, BarChartPropsTypeForWeb } from './types';
2
2
  import { type BarAndLineChartsWrapperTypes, type secondaryYAxisType } from '../utils/types';
3
3
  import { type Animated } from 'react-native';
4
- export interface extendedBarChartPropsType extends BarChartPropsType {
4
+ export interface extendedBarChartPropsType extends BarChartPropsTypeForWeb {
5
5
  parentWidth: number;
6
6
  heightValue?: Animated.Value;
7
7
  widthValue?: Animated.Value;
@@ -156,6 +156,9 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
156
156
  onPress: Function | undefined;
157
157
  onLongPress: Function | undefined;
158
158
  onPressOut: Function | undefined;
159
+ onContextMenu: Function | undefined;
160
+ onMouseEnter: Function | undefined;
161
+ onMouseLeave: Function | undefined;
159
162
  focusBarOnPress: boolean | undefined;
160
163
  focusedBarConfig: import("./types").FocusedBarConfig | undefined;
161
164
  xAxisTextNumberOfLines: number;
@@ -26,15 +26,15 @@ var __read = (this && this.__read) || function (o, n) {
26
26
  return ar;
27
27
  };
28
28
  import { useEffect, useMemo, useState } from 'react';
29
- import { getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getLineConfigForBarChart, getMaxValue, getMostNegativeValue, getNoOfSections, getSecondaryDataWithOffsetIncluded, getXForLineInBar, getYForLineInBar, maxAndMinUtil, svgPath } from '../utils';
29
+ import { getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getLineConfigForBarChart, getMaxValue, getMostNegativeValue, getNoOfSections, getSecondaryDataWithOffsetIncluded, 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;
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;
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 _48 = __read(useState(''), 2), points = _48[0], setPoints = _48[1];
35
- var _49 = __read(useState(''), 2), points2 = _49[0], setPoints2 = _49[1];
36
- var _50 = __read(useState(''), 2), arrowPoints = _50[0], setArrowPoints = _50[1];
37
- var _51 = __read(useState(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1), 2), selectedIndex = _51[0], setSelectedIndex = _51[1];
34
+ var _49 = __read(useState(''), 2), points = _49[0], setPoints = _49[1];
35
+ var _50 = __read(useState(''), 2), points2 = _50[0], setPoints2 = _50[1];
36
+ var _51 = __read(useState(''), 2), arrowPoints = _51[0], setArrowPoints = _51[1];
37
+ var _52 = __read(useState(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1), 2), selectedIndex = _52[0], setSelectedIndex = _52[1];
38
38
  var showLine = (_a = props.showLine) !== null && _a !== void 0 ? _a : BarDefaults.showLine;
39
39
  useEffect(function () {
40
40
  setSelectedIndex(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1);
@@ -66,15 +66,14 @@ export var useBarChart = function (props) {
66
66
  var spacing = (_d = props.spacing) !== null && _d !== void 0 ? _d : (adjustToWidth ? autoComputedSpacing : BarDefaults.spacing);
67
67
  var initialSpacing = (_e = props.initialSpacing) !== null && _e !== void 0 ? _e : spacing;
68
68
  var endSpacing = (_f = props.endSpacing) !== null && _f !== void 0 ? _f : spacing;
69
- var showFractionalValues = (_g = props.showFractionalValues) !== null && _g !== void 0 ? _g : AxesAndRulesDefaults.showFractionalValues;
70
- var horizontal = (_h = props.horizontal) !== null && _h !== void 0 ? _h : BarDefaults.horizontal;
71
- var rtl = (_j = props.rtl) !== null && _j !== void 0 ? _j : BarDefaults.rtl;
72
- var yAxisAtTop = (_k = props.yAxisAtTop) !== null && _k !== void 0 ? _k : BarDefaults.yAxisAtTop;
73
- var intactTopLabel = (_l = props.intactTopLabel) !== null && _l !== void 0 ? _l : BarDefaults.intactTopLabel;
69
+ var horizontal = (_g = props.horizontal) !== null && _g !== void 0 ? _g : BarDefaults.horizontal;
70
+ var rtl = (_h = props.rtl) !== null && _h !== void 0 ? _h : BarDefaults.rtl;
71
+ var yAxisAtTop = (_j = props.yAxisAtTop) !== null && _j !== void 0 ? _j : BarDefaults.yAxisAtTop;
72
+ var intactTopLabel = (_k = props.intactTopLabel) !== null && _k !== void 0 ? _k : BarDefaults.intactTopLabel;
74
73
  var heightFromProps = horizontal ? props.width : props.height;
75
74
  var widthFromProps = horizontal ? props.height : props.width;
76
- var isAnimated = (_m = props.isAnimated) !== null && _m !== void 0 ? _m : BarDefaults.isAnimated;
77
- var animationDuration = (_o = props.animationDuration) !== null && _o !== void 0 ? _o : BarDefaults.animationDuration;
75
+ var isAnimated = (_l = props.isAnimated) !== null && _l !== void 0 ? _l : BarDefaults.isAnimated;
76
+ var animationDuration = (_m = props.animationDuration) !== null && _m !== void 0 ? _m : BarDefaults.animationDuration;
78
77
  var secondaryData = getSecondaryDataWithOffsetIncluded(props.secondaryData, props.secondaryYAxis);
79
78
  var lineData = useMemo(function () {
80
79
  var _a;
@@ -90,7 +89,7 @@ export var useBarChart = function (props) {
90
89
  return props.lineData;
91
90
  }, [yAxisOffset, props.lineData, data, props.stackData]);
92
91
  var lineData2 = props.lineData2;
93
- var lineBehindBars = (_p = props.lineBehindBars) !== null && _p !== void 0 ? _p : BarDefaults.lineBehindBars;
92
+ var lineBehindBars = (_o = props.lineBehindBars) !== null && _o !== void 0 ? _o : BarDefaults.lineBehindBars;
94
93
  defaultLineConfig.initialSpacing = initialSpacing;
95
94
  defaultLineConfig.endIndex = lineData.length - 1;
96
95
  defaultLineConfig.animationDuration = animationDuration;
@@ -105,12 +104,12 @@ export var useBarChart = function (props) {
105
104
  ? props.stepHeight * noOfSections
106
105
  : AxesAndRulesDefaults.containerHeight);
107
106
  var horizSections = [{ value: '0' }];
108
- var stepHeight = (_q = props.stepHeight) !== null && _q !== void 0 ? _q : containerHeight / noOfSections;
109
- var labelWidth = (_r = props.labelWidth) !== null && _r !== void 0 ? _r : AxesAndRulesDefaults.labelWidth;
110
- var scrollToEnd = (_s = props.scrollToEnd) !== null && _s !== void 0 ? _s : BarDefaults.scrollToEnd;
111
- var scrollAnimation = (_t = props.scrollAnimation) !== null && _t !== void 0 ? _t : BarDefaults.scrollAnimation;
112
- var scrollEventThrottle = (_u = props.scrollEventThrottle) !== null && _u !== void 0 ? _u : BarDefaults.scrollEventThrottle;
113
- var labelsExtraHeight = (_v = props.labelsExtraHeight) !== null && _v !== void 0 ? _v : AxesAndRulesDefaults.labelsExtraHeight;
107
+ var stepHeight = (_p = props.stepHeight) !== null && _p !== void 0 ? _p : containerHeight / noOfSections;
108
+ var labelWidth = (_q = props.labelWidth) !== null && _q !== void 0 ? _q : AxesAndRulesDefaults.labelWidth;
109
+ var scrollToEnd = (_r = props.scrollToEnd) !== null && _r !== void 0 ? _r : BarDefaults.scrollToEnd;
110
+ var scrollAnimation = (_s = props.scrollAnimation) !== null && _s !== void 0 ? _s : BarDefaults.scrollAnimation;
111
+ var scrollEventThrottle = (_t = props.scrollEventThrottle) !== null && _t !== void 0 ? _t : BarDefaults.scrollEventThrottle;
112
+ var labelsExtraHeight = (_u = props.labelsExtraHeight) !== null && _u !== void 0 ? _u : AxesAndRulesDefaults.labelsExtraHeight;
114
113
  var totalWidth = initialSpacing + endSpacing;
115
114
  var maxItem = 0;
116
115
  var minItem = 0;
@@ -157,80 +156,83 @@ export var useBarChart = function (props) {
157
156
  }
158
157
  });
159
158
  }
160
- var maxAndMin = maxAndMinUtil(maxItem, minItem, props.roundToDigits, props.showFractionalValues);
161
- var secondaryMaxAndMin = maxAndMinUtil(secondaryMaxItem, secondaryMinItem, props.roundToDigits, props.showFractionalValues);
159
+ var valuesRange = maxItem - minItem;
160
+ var showFractionalValues = (_v = props.showFractionalValues) !== null && _v !== void 0 ? _v : valuesRange <= 1;
161
+ var roundToDigits = (_w = props.roundToDigits) !== null && _w !== void 0 ? _w : (showFractionalValues ? indexOfFirstNonZeroDigit(valuesRange) + 1 : 0);
162
+ var maxAndMin = maxAndMinUtil(maxItem, minItem, roundToDigits, showFractionalValues);
163
+ var secondaryMaxAndMin = maxAndMinUtil(secondaryMaxItem, secondaryMinItem, roundToDigits, showFractionalValues);
162
164
  var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxAndMin.maxItem);
163
165
  var secondaryMaxValue = lineConfig.isSecondary
164
166
  ? typeof props.secondaryYAxis !== 'boolean'
165
- ? (_w = props.secondaryYAxis.maxValue) !== null && _w !== void 0 ? _w : secondaryMaxAndMin.maxItem
167
+ ? (_x = props.secondaryYAxis.maxValue) !== null && _x !== void 0 ? _x : secondaryMaxAndMin.maxItem
166
168
  : secondaryMaxAndMin.maxItem
167
169
  : maxValue;
168
170
  var mostNegativeValue = getMostNegativeValue(props.mostNegativeValue, props.negativeStepValue, props.noOfSectionsBelowXAxis, maxAndMin.minItem);
169
- var stepValue = (_x = props.stepValue) !== null && _x !== void 0 ? _x : maxValue / noOfSections;
170
- var noOfSectionsBelowXAxis = (_y = props.noOfSectionsBelowXAxis) !== null && _y !== void 0 ? _y : Math.round(Math.ceil(-mostNegativeValue / (negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue)));
171
- var showScrollIndicator = (_z = props.showScrollIndicator) !== null && _z !== void 0 ? _z : BarDefaults.showScrollIndicator;
172
- var side = (_0 = props.side) !== null && _0 !== void 0 ? _0 : BarDefaults.side;
173
- var rotateLabel = (_1 = props.rotateLabel) !== null && _1 !== void 0 ? _1 : AxesAndRulesDefaults.rotateLabel;
174
- var opacity = (_2 = props.opacity) !== null && _2 !== void 0 ? _2 : BarDefaults.opacity;
175
- var isThreeD = (_3 = props.isThreeD) !== null && _3 !== void 0 ? _3 : BarDefaults.isThreeD;
176
- var showXAxisIndices = (_4 = props.showXAxisIndices) !== null && _4 !== void 0 ? _4 : AxesAndRulesDefaults.showXAxisIndices;
177
- var xAxisIndicesHeight = (_5 = props.xAxisIndicesHeight) !== null && _5 !== void 0 ? _5 : AxesAndRulesDefaults.xAxisIndicesHeight;
178
- var xAxisIndicesWidth = (_6 = props.xAxisIndicesWidth) !== null && _6 !== void 0 ? _6 : AxesAndRulesDefaults.xAxisIndicesWidth;
179
- var xAxisIndicesColor = (_7 = props.xAxisIndicesColor) !== null && _7 !== void 0 ? _7 : AxesAndRulesDefaults.xAxisIndicesColor;
180
- var xAxisThickness = (_8 = props.xAxisThickness) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.xAxisThickness;
181
- var xAxisTextNumberOfLines = (_9 = props.xAxisTextNumberOfLines) !== null && _9 !== void 0 ? _9 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
182
- var xAxisLabelsVerticalShift = (_10 = props.xAxisLabelsVerticalShift) !== null && _10 !== void 0 ? _10 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
171
+ var stepValue = (_y = props.stepValue) !== null && _y !== void 0 ? _y : maxValue / noOfSections;
172
+ var noOfSectionsBelowXAxis = (_z = props.noOfSectionsBelowXAxis) !== null && _z !== void 0 ? _z : Math.round(Math.ceil(-mostNegativeValue / (negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue)));
173
+ var showScrollIndicator = (_0 = props.showScrollIndicator) !== null && _0 !== void 0 ? _0 : BarDefaults.showScrollIndicator;
174
+ var side = (_1 = props.side) !== null && _1 !== void 0 ? _1 : BarDefaults.side;
175
+ var rotateLabel = (_2 = props.rotateLabel) !== null && _2 !== void 0 ? _2 : AxesAndRulesDefaults.rotateLabel;
176
+ var opacity = (_3 = props.opacity) !== null && _3 !== void 0 ? _3 : BarDefaults.opacity;
177
+ var isThreeD = (_4 = props.isThreeD) !== null && _4 !== void 0 ? _4 : BarDefaults.isThreeD;
178
+ var showXAxisIndices = (_5 = props.showXAxisIndices) !== null && _5 !== void 0 ? _5 : AxesAndRulesDefaults.showXAxisIndices;
179
+ var xAxisIndicesHeight = (_6 = props.xAxisIndicesHeight) !== null && _6 !== void 0 ? _6 : AxesAndRulesDefaults.xAxisIndicesHeight;
180
+ var xAxisIndicesWidth = (_7 = props.xAxisIndicesWidth) !== null && _7 !== void 0 ? _7 : AxesAndRulesDefaults.xAxisIndicesWidth;
181
+ var xAxisIndicesColor = (_8 = props.xAxisIndicesColor) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.xAxisIndicesColor;
182
+ var xAxisThickness = (_9 = props.xAxisThickness) !== null && _9 !== void 0 ? _9 : AxesAndRulesDefaults.xAxisThickness;
183
+ var xAxisTextNumberOfLines = (_10 = props.xAxisTextNumberOfLines) !== null && _10 !== void 0 ? _10 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
184
+ var xAxisLabelsVerticalShift = (_11 = props.xAxisLabelsVerticalShift) !== null && _11 !== void 0 ? _11 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
183
185
  var horizontalRulesStyle = props.horizontalRulesStyle;
184
- var autoShiftLabels = (_11 = props.autoShiftLabels) !== null && _11 !== void 0 ? _11 : false;
185
- var barBorderColor = (_12 = props.barBorderColor) !== null && _12 !== void 0 ? _12 : BarDefaults.barBorderColor;
186
+ var autoShiftLabels = (_12 = props.autoShiftLabels) !== null && _12 !== void 0 ? _12 : false;
187
+ var barBorderColor = (_13 = props.barBorderColor) !== null && _13 !== void 0 ? _13 : BarDefaults.barBorderColor;
186
188
  var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
187
189
  var containerHeightIncludingBelowXAxis = extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
188
- var _52 = __read(useState(-1), 2), pointerIndex = _52[0], setPointerIndex = _52[1];
189
- var _53 = __read(useState(0), 2), pointerX = _53[0], setPointerX = _53[1];
190
- var _54 = __read(useState(0), 2), pointerY = _54[0], setPointerY = _54[1];
191
- var _55 = __read(useState(), 2), pointerItem = _55[0], setPointerItem = _55[1];
192
- var _56 = __read(useState(0), 2), responderStartTime = _56[0], setResponderStartTime = _56[1];
193
- var _57 = __read(useState(false), 2), responderActive = _57[0], setResponderActive = _57[1];
190
+ var _53 = __read(useState(-1), 2), pointerIndex = _53[0], setPointerIndex = _53[1];
191
+ var _54 = __read(useState(0), 2), pointerX = _54[0], setPointerX = _54[1];
192
+ var _55 = __read(useState(0), 2), pointerY = _55[0], setPointerY = _55[1];
193
+ var _56 = __read(useState(), 2), pointerItem = _56[0], setPointerItem = _56[1];
194
+ var _57 = __read(useState(0), 2), responderStartTime = _57[0], setResponderStartTime = _57[1];
195
+ var _58 = __read(useState(false), 2), responderActive = _58[0], setResponderActive = _58[1];
194
196
  var pointerConfig = props.pointerConfig;
195
- var getPointerProps = (_13 = props.getPointerProps) !== null && _13 !== void 0 ? _13 : null;
196
- var pointerHeight = (_14 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _14 !== void 0 ? _14 : defaultPointerConfig.height;
197
- var pointerWidth = (_15 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _15 !== void 0 ? _15 : defaultPointerConfig.width;
198
- var pointerRadius = (_16 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _16 !== void 0 ? _16 : defaultPointerConfig.radius;
199
- var pointerColor = (_17 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _17 !== void 0 ? _17 : defaultPointerConfig.pointerColor;
200
- var pointerComponent = (_18 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _18 !== void 0 ? _18 : defaultPointerConfig.pointerComponent;
197
+ var getPointerProps = (_14 = props.getPointerProps) !== null && _14 !== void 0 ? _14 : null;
198
+ var pointerHeight = (_15 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _15 !== void 0 ? _15 : defaultPointerConfig.height;
199
+ var pointerWidth = (_16 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _16 !== void 0 ? _16 : defaultPointerConfig.width;
200
+ var pointerRadius = (_17 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _17 !== void 0 ? _17 : defaultPointerConfig.radius;
201
+ var pointerColor = (_18 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _18 !== void 0 ? _18 : defaultPointerConfig.pointerColor;
202
+ var pointerComponent = (_19 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _19 !== void 0 ? _19 : defaultPointerConfig.pointerComponent;
201
203
  var showPointerStrip = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.showPointerStrip) === false
202
204
  ? false
203
205
  : defaultPointerConfig.showPointerStrip;
204
- var pointerStripHeight = (_19 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _19 !== void 0 ? _19 : defaultPointerConfig.pointerStripHeight;
205
- var pointerStripWidth = (_20 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _20 !== void 0 ? _20 : defaultPointerConfig.pointerStripWidth;
206
- var pointerStripColor = (_21 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _21 !== void 0 ? _21 : defaultPointerConfig.pointerStripColor;
207
- var pointerStripUptoDataPoint = (_22 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _22 !== void 0 ? _22 : defaultPointerConfig.pointerStripUptoDataPoint;
208
- var pointerLabelComponent = (_23 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _23 !== void 0 ? _23 : defaultPointerConfig.pointerLabelComponent;
209
- var stripOverPointer = (_24 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _24 !== void 0 ? _24 : defaultPointerConfig.stripOverPointer;
210
- var shiftPointerLabelX = (_25 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _25 !== void 0 ? _25 : defaultPointerConfig.shiftPointerLabelX;
211
- var shiftPointerLabelY = (_26 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _26 !== void 0 ? _26 : defaultPointerConfig.shiftPointerLabelY;
212
- var pointerLabelWidth = (_27 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _27 !== void 0 ? _27 : defaultPointerConfig.pointerLabelWidth;
213
- var pointerLabelHeight = (_28 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _28 !== void 0 ? _28 : defaultPointerConfig.pointerLabelHeight;
214
- var autoAdjustPointerLabelPosition = (_29 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _29 !== void 0 ? _29 : defaultPointerConfig.autoAdjustPointerLabelPosition;
215
- var pointerVanishDelay = (_30 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _30 !== void 0 ? _30 : defaultPointerConfig.pointerVanishDelay;
216
- var activatePointersOnLongPress = (_31 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _31 !== void 0 ? _31 : defaultPointerConfig.activatePointersOnLongPress;
217
- var activatePointersDelay = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.activatePointersDelay;
218
- var initialPointerIndex = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.initialPointerIndex;
219
- var initialPointerAppearDelay = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _34 !== void 0 ? _34 : (isAnimated
206
+ var pointerStripHeight = (_20 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _20 !== void 0 ? _20 : defaultPointerConfig.pointerStripHeight;
207
+ var pointerStripWidth = (_21 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _21 !== void 0 ? _21 : defaultPointerConfig.pointerStripWidth;
208
+ var pointerStripColor = (_22 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _22 !== void 0 ? _22 : defaultPointerConfig.pointerStripColor;
209
+ var pointerStripUptoDataPoint = (_23 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _23 !== void 0 ? _23 : defaultPointerConfig.pointerStripUptoDataPoint;
210
+ var pointerLabelComponent = (_24 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _24 !== void 0 ? _24 : defaultPointerConfig.pointerLabelComponent;
211
+ var stripOverPointer = (_25 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _25 !== void 0 ? _25 : defaultPointerConfig.stripOverPointer;
212
+ var shiftPointerLabelX = (_26 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _26 !== void 0 ? _26 : defaultPointerConfig.shiftPointerLabelX;
213
+ var shiftPointerLabelY = (_27 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _27 !== void 0 ? _27 : defaultPointerConfig.shiftPointerLabelY;
214
+ var pointerLabelWidth = (_28 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _28 !== void 0 ? _28 : defaultPointerConfig.pointerLabelWidth;
215
+ var pointerLabelHeight = (_29 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _29 !== void 0 ? _29 : defaultPointerConfig.pointerLabelHeight;
216
+ var autoAdjustPointerLabelPosition = (_30 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _30 !== void 0 ? _30 : defaultPointerConfig.autoAdjustPointerLabelPosition;
217
+ var pointerVanishDelay = (_31 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _31 !== void 0 ? _31 : defaultPointerConfig.pointerVanishDelay;
218
+ var activatePointersOnLongPress = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.activatePointersOnLongPress;
219
+ var activatePointersDelay = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.activatePointersDelay;
220
+ var initialPointerIndex = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _34 !== void 0 ? _34 : defaultPointerConfig.initialPointerIndex;
221
+ var initialPointerAppearDelay = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _35 !== void 0 ? _35 : (isAnimated
220
222
  ? animationDuration
221
223
  : defaultPointerConfig.initialPointerAppearDelay);
222
- var persistPointer = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _35 !== void 0 ? _35 : defaultPointerConfig.persistPointer;
223
- var hidePointer1 = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.hidePointer1;
224
+ var persistPointer = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.persistPointer;
225
+ var hidePointer1 = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.hidePointer1;
224
226
  var pointerEvents = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerEvents;
225
- var stripBehindBars = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.stripBehindBars;
226
- var disableScroll = (_38 = props.disableScroll) !== null && _38 !== void 0 ? _38 : (pointerConfig
227
+ var stripBehindBars = (_38 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _38 !== void 0 ? _38 : defaultPointerConfig.stripBehindBars;
228
+ var disableScroll = (_39 = props.disableScroll) !== null && _39 !== void 0 ? _39 : (pointerConfig
227
229
  ? activatePointersOnLongPress
228
230
  ? !!responderActive
229
231
  : true
230
232
  : false);
231
233
  var yAxisExtraHeightAtTop = props.trimYAxisAtTop
232
234
  ? 0
233
- : (_39 = props.yAxisExtraHeight) !== null && _39 !== void 0 ? _39 : containerHeight / 20;
235
+ : (_40 = props.yAxisExtraHeight) !== null && _40 !== void 0 ? _40 : containerHeight / 20;
234
236
  var barInnerComponent = props.barInnerComponent;
235
237
  useEffect(function () {
236
238
  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;
@@ -346,9 +348,9 @@ export var useBarChart = function (props) {
346
348
  spacing,
347
349
  yAxisLabelWidth,
348
350
  lineConfig.showArrow,
349
- (_40 = lineConfig.arrowConfig) === null || _40 === void 0 ? void 0 : _40.length,
350
- (_41 = lineConfig.arrowConfig) === null || _41 === void 0 ? void 0 : _41.width,
351
- (_42 = lineConfig.arrowConfig) === null || _42 === void 0 ? void 0 : _42.showArrowBase
351
+ (_41 = lineConfig.arrowConfig) === null || _41 === void 0 ? void 0 : _41.length,
352
+ (_42 = lineConfig.arrowConfig) === null || _42 === void 0 ? void 0 : _42.width,
353
+ (_43 = lineConfig.arrowConfig) === null || _43 === void 0 ? void 0 : _43.showArrowBase
352
354
  ]);
353
355
  useEffect(function () {
354
356
  var _a, _b, _c, _d;
@@ -434,6 +436,9 @@ export var useBarChart = function (props) {
434
436
  onPress: props.onPress,
435
437
  onLongPress: props.onLongPress,
436
438
  onPressOut: props.onPressOut,
439
+ onContextMenu: props.onContextMenu,
440
+ onMouseEnter: props.onMouseEnter,
441
+ onMouseLeave: props.onMouseLeave,
437
442
  focusBarOnPress: props.focusBarOnPress,
438
443
  focusedBarConfig: props.focusedBarConfig,
439
444
  xAxisTextNumberOfLines: xAxisTextNumberOfLines,
@@ -468,19 +473,19 @@ export var useBarChart = function (props) {
468
473
  containerHeight: containerHeight,
469
474
  noOfSectionsBelowXAxis: noOfSectionsBelowXAxis,
470
475
  stepHeight: stepHeight,
471
- negativeStepHeight: (_43 = props.negativeStepHeight) !== null && _43 !== void 0 ? _43 : stepHeight,
476
+ negativeStepHeight: (_44 = props.negativeStepHeight) !== null && _44 !== void 0 ? _44 : stepHeight,
472
477
  labelsExtraHeight: labelsExtraHeight,
473
478
  yAxisLabelWidth: yAxisLabelWidth,
474
479
  horizontal: horizontal,
475
480
  rtl: rtl,
476
- shiftX: (_44 = props.shiftX) !== null && _44 !== void 0 ? _44 : 0,
477
- shiftY: (_45 = props.shiftY) !== null && _45 !== void 0 ? _45 : 0,
481
+ shiftX: (_45 = props.shiftX) !== null && _45 !== void 0 ? _45 : 0,
482
+ shiftY: (_46 = props.shiftY) !== null && _46 !== void 0 ? _46 : 0,
478
483
  yAxisAtTop: yAxisAtTop,
479
484
  initialSpacing: initialSpacing,
480
485
  data: data,
481
486
  stackData: props.stackData,
482
487
  secondaryData: secondaryData,
483
- barWidth: (_46 = props.barWidth) !== null && _46 !== void 0 ? _46 : defaultBarWidth,
488
+ barWidth: (_47 = props.barWidth) !== null && _47 !== void 0 ? _47 : defaultBarWidth,
484
489
  xAxisThickness: xAxisThickness,
485
490
  totalWidth: totalWidth,
486
491
  disableScroll: disableScroll,
@@ -512,7 +517,7 @@ export var useBarChart = function (props) {
512
517
  noOfSections: noOfSections,
513
518
  sectionColors: props.sectionColors,
514
519
  showFractionalValues: showFractionalValues,
515
- axesAndRulesProps: getAxesAndRulesProps(props, stepValue, negativeStepValue, secondaryMaxValue),
520
+ axesAndRulesProps: getAxesAndRulesProps(props, stepValue, roundToDigits, negativeStepValue, secondaryMaxValue),
516
521
  yAxisLabelTexts: props.yAxisLabelTexts,
517
522
  yAxisOffset: yAxisOffset,
518
523
  rotateYAxisTexts: props.rotateYAxisTexts,
@@ -529,7 +534,7 @@ export var useBarChart = function (props) {
529
534
  pointerY: pointerY,
530
535
  onEndReached: props.onEndReached,
531
536
  onStartReached: props.onStartReached,
532
- endReachedOffset: (_47 = props.endReachedOffset) !== null && _47 !== void 0 ? _47 : BarDefaults.endReachedOffset,
537
+ endReachedOffset: (_48 = props.endReachedOffset) !== null && _48 !== void 0 ? _48 : BarDefaults.endReachedOffset,
533
538
  onMomentumScrollEnd: props.onMomentumScrollEnd
534
539
  };
535
540
  return {
@@ -39,6 +39,9 @@ export interface stackDataItem {
39
39
  gradientColor?: ColorValue;
40
40
  barWidth?: number;
41
41
  innerBarComponent?: Function;
42
+ onContextMenu?: Function;
43
+ onMouseEnter?: Function;
44
+ onMouseLeave?: Function;
42
45
  }>;
43
46
  barBackgroundPattern?: () => ReactNode;
44
47
  borderRadius?: number;
@@ -50,6 +53,9 @@ export interface stackDataItem {
50
53
  patternId?: string;
51
54
  leftShiftForTooltip?: number;
52
55
  showXAxisIndex?: boolean;
56
+ onContextMenu?: Function;
57
+ onMouseEnter?: Function;
58
+ onMouseLeave?: Function;
53
59
  }
54
60
  export interface StackedBarChartPropsType {
55
61
  style?: any;
@@ -431,6 +437,9 @@ export interface barDataItem {
431
437
  barInnerComponent?: (item?: barDataItem, index?: number) => ReactNode;
432
438
  showXAxisIndex?: boolean;
433
439
  isSecondary?: boolean;
440
+ onContextMenu?: Function;
441
+ onMouseEnter?: Function;
442
+ onMouseLeave?: Function;
434
443
  }
435
444
  export interface Animated2DWithGradientPropsType {
436
445
  item: barDataItem;
@@ -541,6 +550,9 @@ export interface RenderBarsPropsType {
541
550
  onPress?: Function;
542
551
  onLongPress?: Function;
543
552
  onPressOut?: Function;
553
+ onContextMenu?: Function;
554
+ onMouseEnter?: Function;
555
+ onMouseLeave?: Function;
544
556
  xAxisTextNumberOfLines: number;
545
557
  xAxisLabelsHeight?: number;
546
558
  xAxisLabelsVerticalShift: number;
@@ -616,4 +628,9 @@ export interface CommonPropsFor2dand3dBarsType {
616
628
  topLabelTextStyle: any;
617
629
  yAxisOffset: number;
618
630
  }
631
+ export interface BarChartPropsTypeForWeb extends BarChartPropsType {
632
+ onContextMenu?: Function;
633
+ onMouseEnter?: Function;
634
+ onMouseLeave?: Function;
635
+ }
619
636
  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;
32
- var _51 = __read(useState(false), 2), toggle = _51[0], setToggle = _51[1];
33
- var _52 = __read(useState([]), 2), pointsArray = _52[0], setPointsArray = _52[1];
34
- var _53 = __read(useState([]), 2), fillPointsArray = _53[0], setFillPointsArray = _53[1];
35
- var _54 = __read(useState(-1), 2), selectedIndex = _54[0], setSelectedIndex = _54[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;
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];
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 () {
@@ -419,7 +419,7 @@ export var useLineChartBiColor = function (props) {
419
419
  horizontalRulesStyle: horizontalRulesStyle,
420
420
  noOfSections: noOfSections,
421
421
  showFractionalValues: showFractionalValues,
422
- axesAndRulesProps: getAxesAndRulesProps(props, stepValue, undefined),
422
+ axesAndRulesProps: getAxesAndRulesProps(props, stepValue, (_50 = props.roundToDigits) !== null && _50 !== void 0 ? _50 : 0, undefined),
423
423
  yAxisLabelTexts: props.yAxisLabelTexts,
424
424
  yAxisOffset: props.yAxisOffset,
425
425
  rotateYAxisTexts: 0,
@@ -434,7 +434,7 @@ export var useLineChartBiColor = function (props) {
434
434
  pointerIndex: 0,
435
435
  pointerX: 0,
436
436
  pointerY: 0,
437
- endReachedOffset: (_50 = props.endReachedOffset) !== null && _50 !== void 0 ? _50 : LineDefaults.endReachedOffset,
437
+ endReachedOffset: (_51 = props.endReachedOffset) !== null && _51 !== void 0 ? _51 : LineDefaults.endReachedOffset,
438
438
  extraWidthDueToDataPoint: extraWidthDueToDataPoint
439
439
  };
440
440
  return {
@@ -325,6 +325,7 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
325
325
  xAxisLabelsVerticalShift: number;
326
326
  horizontalRulesStyle: any;
327
327
  showFractionalValues: boolean;
328
+ roundToDigits: number;
328
329
  horizontal: boolean;
329
330
  yAxisAtTop: boolean;
330
331
  pointerConfig: import("../utils/types").Pointer | undefined;