gifted-charts-core 0.1.71 → 0.1.74
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/dist/BarChart/index.d.ts +3 -3
- package/dist/BarChart/index.js +85 -82
- package/dist/BarChart/types.d.ts +5 -0
- package/dist/BubbleChart/index.d.ts +50 -0
- package/dist/BubbleChart/index.js +283 -0
- package/dist/BubbleChart/types.d.ts +266 -0
- package/dist/BubbleChart/types.js +1 -0
- package/dist/PieChart/index.d.ts +1 -0
- package/dist/PieChart/index.js +28 -26
- package/dist/PieChart/pro.js +5 -5
- package/dist/PieChart/types.d.ts +1 -1
- package/dist/RadarChart/index.d.ts +7 -0
- package/dist/RadarChart/index.js +48 -40
- package/dist/RadarChart/types.d.ts +2 -0
- package/dist/components/BarAndLineChartsWrapper/index.js +47 -47
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/utils/constants.d.ts +13 -1
- package/dist/utils/constants.js +23 -9
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +15 -10
- package/dist/utils/types.d.ts +8 -0
- package/package.json +1 -1
package/dist/BarChart/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
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:
|
|
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:
|
|
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;
|
package/dist/BarChart/index.js
CHANGED
|
@@ -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
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
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 =
|
|
45
|
-
var
|
|
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 = (
|
|
156
|
-
var labelWidth = (
|
|
157
|
-
var scrollToEnd = (
|
|
158
|
-
var scrollAnimation = (
|
|
159
|
-
var scrollEventThrottle = (
|
|
160
|
-
var 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 = (
|
|
237
|
-
var roundToDigits = (
|
|
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 = (
|
|
242
|
-
var secondaryRoundToDigits = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
260
|
-
var side = (
|
|
261
|
-
var rotateLabel = (
|
|
262
|
-
var opacity = (
|
|
263
|
-
var isThreeD = (
|
|
264
|
-
var showXAxisIndices = (
|
|
265
|
-
var xAxisIndicesHeight = (
|
|
266
|
-
var xAxisIndicesWidth = (
|
|
267
|
-
var xAxisIndicesColor = (
|
|
268
|
-
var xAxisThickness = (
|
|
269
|
-
var xAxisTextNumberOfLines = (
|
|
270
|
-
var xAxisLabelsVerticalShift = (
|
|
271
|
-
var xAxisLabelsAtBottom = (
|
|
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 = (
|
|
274
|
-
var 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
|
|
278
|
-
var primary4thQuadrantHeight = noOfSectionsBelowXAxis * ((
|
|
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
|
|
283
|
-
var
|
|
284
|
-
var
|
|
285
|
-
var
|
|
286
|
-
var
|
|
287
|
-
var
|
|
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 = (
|
|
290
|
-
var pointerHeight = (
|
|
291
|
-
var pointerWidth = (
|
|
292
|
-
var pointerRadius = (
|
|
293
|
-
var pointerColor = (
|
|
294
|
-
var 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 = (
|
|
299
|
-
var pointerStripWidth = (
|
|
300
|
-
var pointerStripColor = (
|
|
301
|
-
var pointerStripUptoDataPoint = (
|
|
302
|
-
var pointerLabelComponent = (
|
|
303
|
-
var stripOverPointer = (
|
|
304
|
-
var shiftPointerLabelX = (
|
|
305
|
-
var shiftPointerLabelY = (
|
|
306
|
-
var pointerLabelWidth = (
|
|
307
|
-
var pointerLabelHeight = (
|
|
308
|
-
var autoAdjustPointerLabelPosition = (
|
|
309
|
-
var pointerVanishDelay = (
|
|
310
|
-
var activatePointersOnLongPress = (
|
|
311
|
-
var activatePointersDelay = (
|
|
312
|
-
var initialPointerIndex = (
|
|
313
|
-
var initialPointerAppearDelay = (
|
|
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 = (
|
|
317
|
-
var 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 = (
|
|
320
|
-
var disableScroll = (
|
|
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
|
-
: (
|
|
330
|
+
: (_65 = props.yAxisExtraHeight) !== null && _65 !== void 0 ? _65 : containerHeight / 20;
|
|
328
331
|
var barInnerComponent = props.barInnerComponent;
|
|
329
332
|
var localYAxisOffset1 = lineConfig.isSecondary
|
|
330
|
-
? (
|
|
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
|
-
? (
|
|
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
|
-
(
|
|
450
|
-
(
|
|
451
|
-
(
|
|
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: (
|
|
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: (
|
|
594
|
-
shiftY: (
|
|
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: (
|
|
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: (
|
|
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,
|
package/dist/BarChart/types.d.ts
CHANGED
|
@@ -157,6 +157,7 @@ export interface StackedBarChartPropsType {
|
|
|
157
157
|
bounces?: boolean;
|
|
158
158
|
overScrollMode?: 'auto' | 'always' | 'never';
|
|
159
159
|
onScrollEndDrag?: (event: any, direction: any) => void;
|
|
160
|
+
rtl?: boolean;
|
|
160
161
|
}
|
|
161
162
|
export interface StackedBarChartPropsTypeForWeb extends StackedBarChartPropsType {
|
|
162
163
|
onContextMenu?: Function;
|
|
@@ -403,6 +404,9 @@ export interface lineConfigType {
|
|
|
403
404
|
focusedDataPointIndex?: number;
|
|
404
405
|
showDataPointLabelOnFocus?: boolean;
|
|
405
406
|
}
|
|
407
|
+
export type lineConfigWithSetFocusedDataPointIndexType = lineConfigType & {
|
|
408
|
+
setFocusedDataPointIndex: (i: number) => void;
|
|
409
|
+
};
|
|
406
410
|
export interface defaultLineConfigType {
|
|
407
411
|
initialSpacing: number;
|
|
408
412
|
curved: boolean;
|
|
@@ -436,6 +440,7 @@ export interface defaultLineConfigType {
|
|
|
436
440
|
focusedDataPointColor: ColorValue;
|
|
437
441
|
focusedDataPointRadius: number;
|
|
438
442
|
showDataPointLabelOnFocus: boolean;
|
|
443
|
+
setFocusedDataPointIndex: (i: number) => void;
|
|
439
444
|
}
|
|
440
445
|
interface arrowType {
|
|
441
446
|
length?: number;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { BarAndLineChartsWrapperTypes } from '../utils/types';
|
|
2
|
+
import { BubbleChartPropsType } from './types';
|
|
3
|
+
export interface extendedBubbleChartPropsType extends BubbleChartPropsType {
|
|
4
|
+
parentWidth: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const useBubbleChart: (props: extendedBubbleChartPropsType) => {
|
|
7
|
+
totalWidth: number;
|
|
8
|
+
animationDuration: number;
|
|
9
|
+
containerHeightIncludingBelowXAxis: number;
|
|
10
|
+
getY: (value: number) => number;
|
|
11
|
+
barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes;
|
|
12
|
+
getX: (spacingArray: number[], index: number) => number;
|
|
13
|
+
maxValue: number;
|
|
14
|
+
selectedIndex: number;
|
|
15
|
+
setSelectedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
16
|
+
showTextOnFocus: boolean;
|
|
17
|
+
focusEnabled: boolean;
|
|
18
|
+
focusTogether: boolean;
|
|
19
|
+
selectedLineNumber: number;
|
|
20
|
+
lastLineNumber: number;
|
|
21
|
+
initialSpacing: number;
|
|
22
|
+
spacing: number;
|
|
23
|
+
containerHeight: number;
|
|
24
|
+
handleFocus: (index: number) => void;
|
|
25
|
+
handleUnFocus: () => void;
|
|
26
|
+
isAnimated: boolean;
|
|
27
|
+
showDataPointOnFocus: boolean;
|
|
28
|
+
showDataPointLabelOnFocus: boolean;
|
|
29
|
+
dataPointsShape: string;
|
|
30
|
+
dataPointsWidth: number;
|
|
31
|
+
dataPointsHeight: number;
|
|
32
|
+
dataPointsColor: string;
|
|
33
|
+
dataPointsRadius: number;
|
|
34
|
+
textColor: string;
|
|
35
|
+
textFontSize: number;
|
|
36
|
+
startIndex: number;
|
|
37
|
+
endIndex: number;
|
|
38
|
+
showValuesAsDataPointsText: boolean;
|
|
39
|
+
cumulativeSpacing: number[];
|
|
40
|
+
hideDataPoints: boolean;
|
|
41
|
+
xAxisLabelsVerticalShift: number;
|
|
42
|
+
labelsExtraHeight: number;
|
|
43
|
+
xAxisThickness: number;
|
|
44
|
+
xAxisTextNumberOfLines: number;
|
|
45
|
+
rotateLabel: boolean;
|
|
46
|
+
allowFontScaling: boolean;
|
|
47
|
+
borderWidth: number;
|
|
48
|
+
borderColor: import("react-native").ColorValue;
|
|
49
|
+
opacity: number;
|
|
50
|
+
};
|