gifted-charts-core 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -29,12 +29,12 @@ import { useEffect, useMemo, useState } from 'react';
29
29
  import { getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getLineConfigForBarChart, getMaxValue, getNoOfSections, getSecondaryDataWithOffsetIncluded, getXForLineInBar, getYForLineInBar, 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;
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;
33
33
  var heightValue = props.heightValue, widthValue = props.widthValue, opacValue = props.opacValue, yAxisOffset = props.yAxisOffset;
34
- var _47 = __read(useState(''), 2), points = _47[0], setPoints = _47[1];
35
- var _48 = __read(useState(''), 2), points2 = _48[0], setPoints2 = _48[1];
36
- var _49 = __read(useState(''), 2), arrowPoints = _49[0], setArrowPoints = _49[1];
37
- var _50 = __read(useState(-1), 2), selectedIndex = _50[0], setSelectedIndex = _50[1];
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(-1), 2), selectedIndex = _51[0], setSelectedIndex = _51[1];
38
38
  var showLine = (_a = props.showLine) !== null && _a !== void 0 ? _a : BarDefaults.showLine;
39
39
  var spacing = (_b = props.spacing) !== null && _b !== void 0 ? _b : BarDefaults.spacing;
40
40
  var initialSpacing = (_c = props.initialSpacing) !== null && _c !== void 0 ? _c : spacing;
@@ -145,78 +145,80 @@ export var useBarChart = function (props) {
145
145
  var secondaryMaxAndMin = maxAndMinUtil(secondaryMaxItem, secondaryMinItem, props.roundToDigits, props.showFractionalValues);
146
146
  var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxAndMin.maxItem);
147
147
  var secondaryMaxValue = lineConfig.isSecondary
148
- ? secondaryMaxAndMin.maxItem
148
+ ? typeof props.secondaryYAxis !== 'boolean'
149
+ ? (_u = props.secondaryYAxis.maxValue) !== null && _u !== void 0 ? _u : secondaryMaxAndMin.maxItem
150
+ : secondaryMaxAndMin.maxItem
149
151
  : maxValue;
150
- var mostNegativeValue = (_u = props.mostNegativeValue) !== null && _u !== void 0 ? _u : maxAndMin.minItem;
151
- var stepValue = (_v = props.stepValue) !== null && _v !== void 0 ? _v : maxValue / noOfSections;
152
- var noOfSectionsBelowXAxis = (_w = props.noOfSectionsBelowXAxis) !== null && _w !== void 0 ? _w : -mostNegativeValue / stepValue;
153
- var showScrollIndicator = (_x = props.showScrollIndicator) !== null && _x !== void 0 ? _x : BarDefaults.showScrollIndicator;
154
- var side = (_y = props.side) !== null && _y !== void 0 ? _y : BarDefaults.side;
155
- var rotateLabel = (_z = props.rotateLabel) !== null && _z !== void 0 ? _z : AxesAndRulesDefaults.rotateLabel;
156
- var opacity = (_0 = props.opacity) !== null && _0 !== void 0 ? _0 : BarDefaults.opacity;
157
- var isThreeD = (_1 = props.isThreeD) !== null && _1 !== void 0 ? _1 : BarDefaults.isThreeD;
158
- var showXAxisIndices = (_2 = props.showXAxisIndices) !== null && _2 !== void 0 ? _2 : AxesAndRulesDefaults.showXAxisIndices;
159
- var xAxisIndicesHeight = (_3 = props.xAxisIndicesHeight) !== null && _3 !== void 0 ? _3 : AxesAndRulesDefaults.xAxisIndicesHeight;
160
- var xAxisIndicesWidth = (_4 = props.xAxisIndicesWidth) !== null && _4 !== void 0 ? _4 : AxesAndRulesDefaults.xAxisIndicesWidth;
161
- var xAxisIndicesColor = (_5 = props.xAxisIndicesColor) !== null && _5 !== void 0 ? _5 : AxesAndRulesDefaults.xAxisIndicesColor;
162
- var xAxisThickness = (_6 = props.xAxisThickness) !== null && _6 !== void 0 ? _6 : AxesAndRulesDefaults.xAxisThickness;
163
- var xAxisTextNumberOfLines = (_7 = props.xAxisTextNumberOfLines) !== null && _7 !== void 0 ? _7 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
164
- var xAxisLabelsVerticalShift = (_8 = props.xAxisLabelsVerticalShift) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
152
+ var mostNegativeValue = (_v = props.mostNegativeValue) !== null && _v !== void 0 ? _v : maxAndMin.minItem;
153
+ var stepValue = (_w = props.stepValue) !== null && _w !== void 0 ? _w : maxValue / noOfSections;
154
+ var noOfSectionsBelowXAxis = (_x = props.noOfSectionsBelowXAxis) !== null && _x !== void 0 ? _x : -mostNegativeValue / stepValue;
155
+ var showScrollIndicator = (_y = props.showScrollIndicator) !== null && _y !== void 0 ? _y : BarDefaults.showScrollIndicator;
156
+ var side = (_z = props.side) !== null && _z !== void 0 ? _z : BarDefaults.side;
157
+ var rotateLabel = (_0 = props.rotateLabel) !== null && _0 !== void 0 ? _0 : AxesAndRulesDefaults.rotateLabel;
158
+ var opacity = (_1 = props.opacity) !== null && _1 !== void 0 ? _1 : BarDefaults.opacity;
159
+ var isThreeD = (_2 = props.isThreeD) !== null && _2 !== void 0 ? _2 : BarDefaults.isThreeD;
160
+ var showXAxisIndices = (_3 = props.showXAxisIndices) !== null && _3 !== void 0 ? _3 : AxesAndRulesDefaults.showXAxisIndices;
161
+ var xAxisIndicesHeight = (_4 = props.xAxisIndicesHeight) !== null && _4 !== void 0 ? _4 : AxesAndRulesDefaults.xAxisIndicesHeight;
162
+ var xAxisIndicesWidth = (_5 = props.xAxisIndicesWidth) !== null && _5 !== void 0 ? _5 : AxesAndRulesDefaults.xAxisIndicesWidth;
163
+ var xAxisIndicesColor = (_6 = props.xAxisIndicesColor) !== null && _6 !== void 0 ? _6 : AxesAndRulesDefaults.xAxisIndicesColor;
164
+ var xAxisThickness = (_7 = props.xAxisThickness) !== null && _7 !== void 0 ? _7 : AxesAndRulesDefaults.xAxisThickness;
165
+ var xAxisTextNumberOfLines = (_8 = props.xAxisTextNumberOfLines) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
166
+ var xAxisLabelsVerticalShift = (_9 = props.xAxisLabelsVerticalShift) !== null && _9 !== void 0 ? _9 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
165
167
  var horizontalRulesStyle = props.horizontalRulesStyle;
166
- var yAxisLabelWidth = (_9 = props.yAxisLabelWidth) !== null && _9 !== void 0 ? _9 : (props.hideYAxisText
168
+ var yAxisLabelWidth = (_10 = props.yAxisLabelWidth) !== null && _10 !== void 0 ? _10 : (props.hideYAxisText
167
169
  ? AxesAndRulesDefaults.yAxisEmptyLabelWidth
168
170
  : AxesAndRulesDefaults.yAxisLabelWidth);
169
- var autoShiftLabels = (_10 = props.autoShiftLabels) !== null && _10 !== void 0 ? _10 : false;
170
- var barWidth = (_11 = props.barWidth) !== null && _11 !== void 0 ? _11 : BarDefaults.barWidth;
171
- var barBorderColor = (_12 = props.barBorderColor) !== null && _12 !== void 0 ? _12 : BarDefaults.barBorderColor;
171
+ var autoShiftLabels = (_11 = props.autoShiftLabels) !== null && _11 !== void 0 ? _11 : false;
172
+ var barWidth = (_12 = props.barWidth) !== null && _12 !== void 0 ? _12 : BarDefaults.barWidth;
173
+ var barBorderColor = (_13 = props.barBorderColor) !== null && _13 !== void 0 ? _13 : BarDefaults.barBorderColor;
172
174
  var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
173
175
  var containerHeightIncludingBelowXAxis = extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
174
- var _51 = __read(useState(-1), 2), pointerIndex = _51[0], setPointerIndex = _51[1];
175
- var _52 = __read(useState(0), 2), pointerX = _52[0], setPointerX = _52[1];
176
- var _53 = __read(useState(0), 2), pointerY = _53[0], setPointerY = _53[1];
177
- var _54 = __read(useState(), 2), pointerItem = _54[0], setPointerItem = _54[1];
178
- var _55 = __read(useState(0), 2), responderStartTime = _55[0], setResponderStartTime = _55[1];
179
- var _56 = __read(useState(false), 2), responderActive = _56[0], setResponderActive = _56[1];
176
+ var _52 = __read(useState(-1), 2), pointerIndex = _52[0], setPointerIndex = _52[1];
177
+ var _53 = __read(useState(0), 2), pointerX = _53[0], setPointerX = _53[1];
178
+ var _54 = __read(useState(0), 2), pointerY = _54[0], setPointerY = _54[1];
179
+ var _55 = __read(useState(), 2), pointerItem = _55[0], setPointerItem = _55[1];
180
+ var _56 = __read(useState(0), 2), responderStartTime = _56[0], setResponderStartTime = _56[1];
181
+ var _57 = __read(useState(false), 2), responderActive = _57[0], setResponderActive = _57[1];
180
182
  var pointerConfig = props.pointerConfig;
181
- var getPointerProps = (_13 = props.getPointerProps) !== null && _13 !== void 0 ? _13 : null;
182
- var pointerHeight = (_14 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _14 !== void 0 ? _14 : defaultPointerConfig.height;
183
- var pointerWidth = (_15 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _15 !== void 0 ? _15 : defaultPointerConfig.width;
184
- var pointerRadius = (_16 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _16 !== void 0 ? _16 : defaultPointerConfig.radius;
185
- var pointerColor = (_17 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _17 !== void 0 ? _17 : defaultPointerConfig.pointerColor;
186
- var pointerComponent = (_18 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _18 !== void 0 ? _18 : defaultPointerConfig.pointerComponent;
183
+ var getPointerProps = (_14 = props.getPointerProps) !== null && _14 !== void 0 ? _14 : null;
184
+ var pointerHeight = (_15 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _15 !== void 0 ? _15 : defaultPointerConfig.height;
185
+ var pointerWidth = (_16 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _16 !== void 0 ? _16 : defaultPointerConfig.width;
186
+ var pointerRadius = (_17 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _17 !== void 0 ? _17 : defaultPointerConfig.radius;
187
+ var pointerColor = (_18 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _18 !== void 0 ? _18 : defaultPointerConfig.pointerColor;
188
+ var pointerComponent = (_19 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _19 !== void 0 ? _19 : defaultPointerConfig.pointerComponent;
187
189
  var showPointerStrip = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.showPointerStrip) === false
188
190
  ? false
189
191
  : defaultPointerConfig.showPointerStrip;
190
- var pointerStripHeight = (_19 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _19 !== void 0 ? _19 : defaultPointerConfig.pointerStripHeight;
191
- var pointerStripWidth = (_20 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _20 !== void 0 ? _20 : defaultPointerConfig.pointerStripWidth;
192
- var pointerStripColor = (_21 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _21 !== void 0 ? _21 : defaultPointerConfig.pointerStripColor;
193
- var pointerStripUptoDataPoint = (_22 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _22 !== void 0 ? _22 : defaultPointerConfig.pointerStripUptoDataPoint;
194
- var pointerLabelComponent = (_23 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _23 !== void 0 ? _23 : defaultPointerConfig.pointerLabelComponent;
195
- var stripOverPointer = (_24 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _24 !== void 0 ? _24 : defaultPointerConfig.stripOverPointer;
196
- var shiftPointerLabelX = (_25 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _25 !== void 0 ? _25 : defaultPointerConfig.shiftPointerLabelX;
197
- var shiftPointerLabelY = (_26 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _26 !== void 0 ? _26 : defaultPointerConfig.shiftPointerLabelY;
198
- var pointerLabelWidth = (_27 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _27 !== void 0 ? _27 : defaultPointerConfig.pointerLabelWidth;
199
- var pointerLabelHeight = (_28 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _28 !== void 0 ? _28 : defaultPointerConfig.pointerLabelHeight;
200
- var autoAdjustPointerLabelPosition = (_29 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _29 !== void 0 ? _29 : defaultPointerConfig.autoAdjustPointerLabelPosition;
201
- var pointerVanishDelay = (_30 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _30 !== void 0 ? _30 : defaultPointerConfig.pointerVanishDelay;
202
- var activatePointersOnLongPress = (_31 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _31 !== void 0 ? _31 : defaultPointerConfig.activatePointersOnLongPress;
203
- var activatePointersDelay = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.activatePointersDelay;
204
- var initialPointerIndex = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.initialPointerIndex;
205
- var initialPointerAppearDelay = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _34 !== void 0 ? _34 : (isAnimated
192
+ var pointerStripHeight = (_20 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _20 !== void 0 ? _20 : defaultPointerConfig.pointerStripHeight;
193
+ var pointerStripWidth = (_21 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _21 !== void 0 ? _21 : defaultPointerConfig.pointerStripWidth;
194
+ var pointerStripColor = (_22 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _22 !== void 0 ? _22 : defaultPointerConfig.pointerStripColor;
195
+ var pointerStripUptoDataPoint = (_23 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _23 !== void 0 ? _23 : defaultPointerConfig.pointerStripUptoDataPoint;
196
+ var pointerLabelComponent = (_24 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _24 !== void 0 ? _24 : defaultPointerConfig.pointerLabelComponent;
197
+ var stripOverPointer = (_25 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _25 !== void 0 ? _25 : defaultPointerConfig.stripOverPointer;
198
+ var shiftPointerLabelX = (_26 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _26 !== void 0 ? _26 : defaultPointerConfig.shiftPointerLabelX;
199
+ var shiftPointerLabelY = (_27 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _27 !== void 0 ? _27 : defaultPointerConfig.shiftPointerLabelY;
200
+ var pointerLabelWidth = (_28 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _28 !== void 0 ? _28 : defaultPointerConfig.pointerLabelWidth;
201
+ var pointerLabelHeight = (_29 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _29 !== void 0 ? _29 : defaultPointerConfig.pointerLabelHeight;
202
+ var autoAdjustPointerLabelPosition = (_30 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _30 !== void 0 ? _30 : defaultPointerConfig.autoAdjustPointerLabelPosition;
203
+ var pointerVanishDelay = (_31 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _31 !== void 0 ? _31 : defaultPointerConfig.pointerVanishDelay;
204
+ var activatePointersOnLongPress = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.activatePointersOnLongPress;
205
+ var activatePointersDelay = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.activatePointersDelay;
206
+ var initialPointerIndex = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _34 !== void 0 ? _34 : defaultPointerConfig.initialPointerIndex;
207
+ var initialPointerAppearDelay = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _35 !== void 0 ? _35 : (isAnimated
206
208
  ? animationDuration
207
209
  : defaultPointerConfig.initialPointerAppearDelay);
208
- var persistPointer = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _35 !== void 0 ? _35 : defaultPointerConfig.persistPointer;
209
- var hidePointer1 = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.hidePointer1;
210
+ var persistPointer = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.persistPointer;
211
+ var hidePointer1 = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.hidePointer1;
210
212
  var pointerEvents = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerEvents;
211
- var stripBehindBars = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.stripBehindBars;
212
- var disableScroll = (_38 = props.disableScroll) !== null && _38 !== void 0 ? _38 : (pointerConfig
213
+ var stripBehindBars = (_38 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _38 !== void 0 ? _38 : defaultPointerConfig.stripBehindBars;
214
+ var disableScroll = (_39 = props.disableScroll) !== null && _39 !== void 0 ? _39 : (pointerConfig
213
215
  ? activatePointersOnLongPress
214
216
  ? !!responderActive
215
217
  : true
216
218
  : false);
217
219
  var yAxisExtraHeightAtTop = props.trimYAxisAtTop
218
220
  ? 0
219
- : (_39 = props.yAxisExtraHeight) !== null && _39 !== void 0 ? _39 : containerHeight / 20;
221
+ : (_40 = props.yAxisExtraHeight) !== null && _40 !== void 0 ? _40 : containerHeight / 20;
220
222
  var barInnerComponent = props.barInnerComponent;
221
223
  useEffect(function () {
222
224
  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;
@@ -332,9 +334,9 @@ export var useBarChart = function (props) {
332
334
  spacing,
333
335
  yAxisLabelWidth,
334
336
  lineConfig.showArrow,
335
- (_40 = lineConfig.arrowConfig) === null || _40 === void 0 ? void 0 : _40.length,
336
- (_41 = lineConfig.arrowConfig) === null || _41 === void 0 ? void 0 : _41.width,
337
- (_42 = lineConfig.arrowConfig) === null || _42 === void 0 ? void 0 : _42.showArrowBase
337
+ (_41 = lineConfig.arrowConfig) === null || _41 === void 0 ? void 0 : _41.length,
338
+ (_42 = lineConfig.arrowConfig) === null || _42 === void 0 ? void 0 : _42.width,
339
+ (_43 = lineConfig.arrowConfig) === null || _43 === void 0 ? void 0 : _43.showArrowBase
338
340
  ]);
339
341
  useEffect(function () {
340
342
  var _a, _b, _c, _d;
@@ -449,14 +451,14 @@ export var useBarChart = function (props) {
449
451
  yAxisLabelWidth: yAxisLabelWidth,
450
452
  horizontal: horizontal,
451
453
  rtl: rtl,
452
- shiftX: (_43 = props.shiftX) !== null && _43 !== void 0 ? _43 : 0,
453
- shiftY: (_44 = props.shiftY) !== null && _44 !== void 0 ? _44 : 0,
454
+ shiftX: (_44 = props.shiftX) !== null && _44 !== void 0 ? _44 : 0,
455
+ shiftY: (_45 = props.shiftY) !== null && _45 !== void 0 ? _45 : 0,
454
456
  yAxisAtTop: yAxisAtTop,
455
457
  initialSpacing: initialSpacing,
456
458
  data: data,
457
459
  stackData: props.stackData,
458
460
  secondaryData: secondaryData,
459
- barWidth: (_45 = props.barWidth) !== null && _45 !== void 0 ? _45 : BarDefaults.barWidth,
461
+ barWidth: (_46 = props.barWidth) !== null && _46 !== void 0 ? _46 : BarDefaults.barWidth,
460
462
  xAxisThickness: xAxisThickness,
461
463
  totalWidth: totalWidth,
462
464
  disableScroll: disableScroll,
@@ -503,7 +505,8 @@ export var useBarChart = function (props) {
503
505
  pointerY: pointerY,
504
506
  onEndReached: props.onEndReached,
505
507
  onStartReached: props.onStartReached,
506
- endReachedOffset: (_46 = props.endReachedOffset) !== null && _46 !== void 0 ? _46 : BarDefaults.endReachedOffset
508
+ endReachedOffset: (_47 = props.endReachedOffset) !== null && _47 !== void 0 ? _47 : BarDefaults.endReachedOffset,
509
+ onMomentumScrollEnd: props.onMomentumScrollEnd
507
510
  };
508
511
  return {
509
512
  lineConfig: lineConfig,
@@ -204,7 +204,10 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
204
204
  maxAndMin.maxItem
205
205
  )
206
206
  const secondaryMaxValue = lineConfig.isSecondary
207
- ? secondaryMaxAndMin.maxItem
207
+ ? typeof props.secondaryYAxis !== 'boolean'
208
+ ? (props.secondaryYAxis as secondaryYAxisType).maxValue ??
209
+ secondaryMaxAndMin.maxItem
210
+ : secondaryMaxAndMin.maxItem
208
211
  : maxValue
209
212
  const mostNegativeValue = props.mostNegativeValue ?? maxAndMin.minItem
210
213
 
@@ -733,7 +736,8 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
733
736
 
734
737
  onEndReached: props.onEndReached,
735
738
  onStartReached: props.onStartReached,
736
- endReachedOffset: props.endReachedOffset ?? BarDefaults.endReachedOffset
739
+ endReachedOffset: props.endReachedOffset ?? BarDefaults.endReachedOffset,
740
+ onMomentumScrollEnd: props.onMomentumScrollEnd
737
741
  }
738
742
 
739
743
  return {
@@ -275,6 +275,7 @@ export interface BarChartPropsType {
275
275
  onStartReached?: () => void;
276
276
  endReachedOffset?: number;
277
277
  onScroll?: Function;
278
+ onMomentumScrollEnd?: Function;
278
279
  focusBarOnPress?: boolean;
279
280
  focusedBarConfig?: FocusedBarConfig;
280
281
  }
@@ -309,6 +309,7 @@ export interface BarChartPropsType {
309
309
  onStartReached?: () => void
310
310
  endReachedOffset?: number
311
311
  onScroll?: Function
312
+ onMomentumScrollEnd?: Function
312
313
 
313
314
  focusBarOnPress?: boolean
314
315
  focusedBarConfig?: FocusedBarConfig
@@ -306,7 +306,7 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
306
306
  addLeadingAndTrailingPathForAreaFill: (initialPath: string, value: number, dataLength: number) => string;
307
307
  getNextPoint: (data: lineDataItem[], index: number, around: boolean, before: boolean) => string;
308
308
  getStepPath: (data: lineDataItem[], i: number) => string;
309
- getSegmentPath: (data: lineDataItem[], i: number, lineSegment: LineSegment[] | undefined, startIndex: number, endIndex: number) => string;
309
+ getSegmentPath: (data: lineDataItem[], i: number, lineSegment: LineSegment[] | undefined, startIndex: number, endIndex: number, isSecondary?: boolean) => string;
310
310
  gradientDirection: string;
311
311
  horizSections: {
312
312
  value: string;
@@ -414,11 +414,11 @@ export var useLineChart = function (props) {
414
414
  getY(data[i].value) +
415
415
  getNextPoint(data, i, around, before));
416
416
  };
417
- var getSegmentPath = function (data, i, lineSegment, startIndex, endIndex) {
417
+ var getSegmentPath = function (data, i, lineSegment, startIndex, endIndex, isSecondary) {
418
418
  var path = 'L' +
419
419
  getX(i) +
420
420
  ' ' +
421
- getY(data[i].value) +
421
+ (isSecondary ? getSecondaryY(data[i].value) : getY(data[i].value)) +
422
422
  ' ' +
423
423
  getSegmentString(lineSegment, i, SEGMENT_START, SEGMENT_END);
424
424
  if (highlightedRange) {
@@ -439,7 +439,12 @@ export var useLineChart = function (props) {
439
439
  for (var i = 0; i < set.data.length; i++) {
440
440
  if (i >= ((_b = set.startIndex) !== null && _b !== void 0 ? _b : 0) &&
441
441
  i <= ((_c = set.endIndex) !== null && _c !== void 0 ? _c : set.data.length - 1)) {
442
- pArray.push([getX(i), getY(set.data[i].value)]);
442
+ pArray.push([
443
+ getX(i),
444
+ set.isSecondary
445
+ ? getSecondaryY(set.data[i].value)
446
+ : getY(set.data[i].value)
447
+ ]);
443
448
  }
444
449
  }
445
450
  var xx = svgPath(pArray, (_d = set.curveType) !== null && _d !== void 0 ? _d : curveType, (_e = set.curvature) !== null && _e !== void 0 ? _e : curvature);
@@ -468,7 +473,7 @@ export var useLineChart = function (props) {
468
473
  pp += getStepPath(set.data, i);
469
474
  }
470
475
  else {
471
- pp += getSegmentPath(set.data, i, set.lineSegments, (_l = set.startIndex) !== null && _l !== void 0 ? _l : 0, (_m = set.endIndex) !== null && _m !== void 0 ? _m : set.data.length - 1);
476
+ pp += getSegmentPath(set.data, i, set.lineSegments, (_l = set.startIndex) !== null && _l !== void 0 ? _l : 0, (_m = set.endIndex) !== null && _m !== void 0 ? _m : set.data.length - 1, set.isSecondary);
472
477
  }
473
478
  }
474
479
  }
@@ -1071,7 +1076,8 @@ export var useLineChart = function (props) {
1071
1076
  pointerY: pointerY,
1072
1077
  onEndReached: props.onEndReached,
1073
1078
  onStartReached: props.onStartReached,
1074
- endReachedOffset: (_291 = props.endReachedOffset) !== null && _291 !== void 0 ? _291 : LineDefaults.endReachedOffset
1079
+ endReachedOffset: (_291 = props.endReachedOffset) !== null && _291 !== void 0 ? _291 : LineDefaults.endReachedOffset,
1080
+ onMomentumScrollEnd: props.onMomentumScrollEnd
1075
1081
  };
1076
1082
  return {
1077
1083
  curvature: curvature,
@@ -727,13 +727,14 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
727
727
  i: number,
728
728
  lineSegment: LineSegment[] | undefined,
729
729
  startIndex: number,
730
- endIndex: number
730
+ endIndex: number,
731
+ isSecondary?: boolean
731
732
  ): string => {
732
733
  let path =
733
734
  'L' +
734
735
  getX(i) +
735
736
  ' ' +
736
- getY(data[i].value) +
737
+ (isSecondary ? getSecondaryY(data[i].value) : getY(data[i].value)) +
737
738
  ' ' +
738
739
  getSegmentString(lineSegment, i, SEGMENT_START, SEGMENT_END)
739
740
 
@@ -764,7 +765,12 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
764
765
  i >= (set.startIndex ?? 0) &&
765
766
  i <= (set.endIndex ?? set.data.length - 1)
766
767
  ) {
767
- pArray.push([getX(i), getY(set.data[i].value)])
768
+ pArray.push([
769
+ getX(i),
770
+ set.isSecondary
771
+ ? getSecondaryY(set.data[i].value)
772
+ : getY(set.data[i].value)
773
+ ])
768
774
  }
769
775
  }
770
776
  let xx = svgPath(
@@ -825,7 +831,8 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
825
831
  i,
826
832
  set.lineSegments,
827
833
  set.startIndex ?? 0,
828
- set.endIndex ?? set.data.length - 1
834
+ set.endIndex ?? set.data.length - 1,
835
+ set.isSecondary
829
836
  )
830
837
  }
831
838
  }
@@ -1780,7 +1787,8 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
1780
1787
 
1781
1788
  onEndReached: props.onEndReached,
1782
1789
  onStartReached: props.onStartReached,
1783
- endReachedOffset: props.endReachedOffset ?? LineDefaults.endReachedOffset
1790
+ endReachedOffset: props.endReachedOffset ?? LineDefaults.endReachedOffset,
1791
+ onMomentumScrollEnd: props.onMomentumScrollEnd
1784
1792
  }
1785
1793
 
1786
1794
  return {
@@ -288,6 +288,7 @@ export interface LineChartPropsType {
288
288
  onStartReached?: () => void;
289
289
  endReachedOffset?: number;
290
290
  onScroll?: Function;
291
+ onMomentumScrollEnd?: Function;
291
292
  showDataPointsForMissingValues?: boolean;
292
293
  interpolateMissingValues?: boolean;
293
294
  onlyPositive?: boolean;
@@ -320,6 +320,7 @@ export interface LineChartPropsType {
320
320
  onStartReached?: () => void
321
321
  endReachedOffset?: number
322
322
  onScroll?: Function
323
+ onMomentumScrollEnd?: Function
323
324
 
324
325
  showDataPointsForMissingValues?: boolean
325
326
  interpolateMissingValues?: boolean
@@ -34,9 +34,9 @@ export var usePiePro = function (props) {
34
34
  var heightFactor = semiCircle ? 1 : 2;
35
35
  var height = radius + maxStrokeWidth;
36
36
  var svgProps = {
37
- height: (radius + maxStrokeWidth) * 2,
38
- width: (radius + maxStrokeWidth) * 2,
39
- viewBox: "".concat(-maxStrokeWidth, " ").concat(-maxStrokeWidth - (semiCircle ? height / 2 : 0), " ").concat((radius + maxStrokeWidth) * 2, " ").concat((radius + maxStrokeWidth) * 2)
37
+ height: height * 2,
38
+ width: height * 2,
39
+ viewBox: "".concat(-maxStrokeWidth * 1.5, " ").concat(-maxStrokeWidth - (semiCircle ? height / 2 : 0), " ").concat(height * 2, " ").concat(height * 2)
40
40
  };
41
41
  // let endAngleLocal = 0
42
42
  var addValues = function (index) {
@@ -57,11 +57,11 @@ export const usePiePro = (props: PieChartPropsType): IusePiePro => {
57
57
  const height = radius + maxStrokeWidth
58
58
 
59
59
  const svgProps = {
60
- height: (radius + maxStrokeWidth) * 2,
61
- width: (radius + maxStrokeWidth) * 2,
62
- viewBox: `${-maxStrokeWidth} ${
60
+ height: height * 2,
61
+ width: height * 2,
62
+ viewBox: `${-maxStrokeWidth * 1.5} ${
63
63
  -maxStrokeWidth - (semiCircle ? height / 2 : 0)
64
- } ${(radius + maxStrokeWidth) * 2} ${(radius + maxStrokeWidth) * 2}`
64
+ } ${height * 2} ${height * 2}`
65
65
  }
66
66
 
67
67
  // let endAngleLocal = 0
@@ -234,6 +234,7 @@ export interface BarAndLineChartsWrapperTypes {
234
234
  scrollEventThrottle: number;
235
235
  onEndReached?: () => void;
236
236
  onStartReached?: () => void;
237
+ onMomentumScrollEnd?: Function;
237
238
  endReachedOffset: number;
238
239
  isRTL?: boolean;
239
240
  }
@@ -334,5 +335,6 @@ export interface DataSet {
334
335
  curvature?: number;
335
336
  curveType?: CurveType;
336
337
  lineSegments?: LineSegment[];
338
+ isSecondary?: boolean;
337
339
  }
338
340
  export {};
@@ -265,6 +265,7 @@ export interface BarAndLineChartsWrapperTypes {
265
265
 
266
266
  onEndReached?: () => void
267
267
  onStartReached?: () => void
268
+ onMomentumScrollEnd?: Function
268
269
  endReachedOffset: number
269
270
  isRTL?: boolean
270
271
  }
@@ -371,4 +372,5 @@ export interface DataSet {
371
372
  curvature?: number
372
373
  curveType?: CurveType
373
374
  lineSegments?: LineSegment[]
375
+ isSecondary?: boolean
374
376
  }