gifted-charts-core 0.1.65 → 0.1.67
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 +1 -0
- package/dist/BarChart/index.js +105 -101
- package/dist/BarChart/types.d.ts +3 -0
- package/dist/LineChart/LineChartBiColor.d.ts +1 -0
- package/dist/LineChart/LineChartBiColor.js +86 -82
- package/dist/LineChart/index.d.ts +3 -2
- package/dist/LineChart/index.js +322 -311
- package/dist/LineChart/types.d.ts +7 -0
- package/dist/components/BarAndLineChartsWrapper/index.js +4 -2
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +2 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/BarChart/index.d.ts
CHANGED
|
@@ -205,4 +205,5 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
205
205
|
yAxisExtraHeightAtTop: number;
|
|
206
206
|
selectedStackIndex: number;
|
|
207
207
|
setSelectedStackIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
208
|
+
allowFontScaling: boolean;
|
|
208
209
|
};
|
package/dist/BarChart/index.js
CHANGED
|
@@ -29,19 +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;
|
|
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
|
|
35
|
-
var _70 = __read(useState(''), 2),
|
|
36
|
-
var _71 = __read(useState(''), 2),
|
|
37
|
-
var _72 = __read(useState(
|
|
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;
|
|
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, floatingYAxisLabels = props.floatingYAxisLabels;
|
|
34
|
+
var allowFontScaling = (_a = props.allowFontScaling) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.allowFontScaling;
|
|
35
|
+
var _70 = __read(useState(''), 2), points = _70[0], setPoints = _70[1];
|
|
36
|
+
var _71 = __read(useState(''), 2), points2 = _71[0], setPoints2 = _71[1];
|
|
37
|
+
var _72 = __read(useState(''), 2), arrowPoints = _72[0], setArrowPoints = _72[1];
|
|
38
|
+
var _73 = __read(useState(function () {
|
|
38
39
|
if (Array.isArray(focusedBarIndex)) {
|
|
39
40
|
return focusedBarIndex;
|
|
40
41
|
}
|
|
41
42
|
return [focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1];
|
|
42
|
-
}), 2), selectedIndex =
|
|
43
|
-
var
|
|
44
|
-
var showLine = (
|
|
43
|
+
}), 2), selectedIndex = _73[0], setSelectedIndex = _73[1];
|
|
44
|
+
var _74 = __read(useState((_b = props.highlightedStackIndex) !== null && _b !== void 0 ? _b : -1), 2), selectedStackIndex = _74[0], setSelectedStackIndex = _74[1];
|
|
45
|
+
var showLine = (_c = props.showLine) !== null && _c !== void 0 ? _c : BarDefaults.showLine;
|
|
45
46
|
useEffect(function () {
|
|
46
47
|
var newIndex = Array.isArray(focusedBarIndex)
|
|
47
48
|
? focusedBarIndex
|
|
@@ -52,10 +53,10 @@ export var useBarChart = function (props) {
|
|
|
52
53
|
var _a;
|
|
53
54
|
setSelectedStackIndex((_a = props.highlightedStackIndex) !== null && _a !== void 0 ? _a : -1);
|
|
54
55
|
}, [props.highlightedStackIndex]);
|
|
55
|
-
var highlightEnabled = (
|
|
56
|
-
var highlightedBarIndex = (
|
|
57
|
-
var lowlightOpacity = (
|
|
58
|
-
var stackHighlightEnabled = (
|
|
56
|
+
var highlightEnabled = (_d = props.highlightEnabled) !== null && _d !== void 0 ? _d : BarDefaults.highlightEnabled;
|
|
57
|
+
var highlightedBarIndex = (_e = props.highlightedBarIndex) !== null && _e !== void 0 ? _e : selectedIndex;
|
|
58
|
+
var lowlightOpacity = (_f = props.lowlightOpacity) !== null && _f !== void 0 ? _f : BarDefaults.lowlightOpacity;
|
|
59
|
+
var stackHighlightEnabled = (_g = props.stackHighlightEnabled) !== null && _g !== void 0 ? _g : BarDefaults.stackHighlightEnabled;
|
|
59
60
|
var data = useMemo(function () {
|
|
60
61
|
if (!props.data) {
|
|
61
62
|
return [];
|
|
@@ -94,8 +95,8 @@ export var useBarChart = function (props) {
|
|
|
94
95
|
return props.stackData;
|
|
95
96
|
}, [yAxisOffset, props.stackData]);
|
|
96
97
|
// adjustToWidth should work for data or stacked data
|
|
97
|
-
var dataLength = (
|
|
98
|
-
var yAxisLabelWidth = (
|
|
98
|
+
var dataLength = (_l = (_j = (_h = props.data) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : (_k = props.stackData) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0;
|
|
99
|
+
var yAxisLabelWidth = (_m = props.yAxisLabelWidth) !== null && _m !== void 0 ? _m : (props.hideYAxisText
|
|
99
100
|
? AxesAndRulesDefaults.yAxisEmptyLabelWidth
|
|
100
101
|
: AxesAndRulesDefaults.yAxisLabelWidth);
|
|
101
102
|
var autoComputedSectionWidth = props.initialSpacing !== undefined
|
|
@@ -105,19 +106,19 @@ export var useBarChart = function (props) {
|
|
|
105
106
|
var defaultBarWidth = adjustToWidth
|
|
106
107
|
? autoComputedBarWidth
|
|
107
108
|
: BarDefaults.barWidth;
|
|
108
|
-
var barWidth = (
|
|
109
|
+
var barWidth = (_o = props.barWidth) !== null && _o !== void 0 ? _o : defaultBarWidth;
|
|
109
110
|
var autoComputedSpacing = autoComputedSectionWidth * 0.4;
|
|
110
|
-
var spacing = (
|
|
111
|
-
var initialSpacing = (
|
|
112
|
-
var endSpacing = (
|
|
113
|
-
var horizontal = (
|
|
114
|
-
var rtl = (
|
|
115
|
-
var yAxisAtTop = (
|
|
116
|
-
var intactTopLabel = (
|
|
111
|
+
var spacing = (_p = props.spacing) !== null && _p !== void 0 ? _p : (adjustToWidth ? autoComputedSpacing : BarDefaults.spacing);
|
|
112
|
+
var initialSpacing = (_q = props.initialSpacing) !== null && _q !== void 0 ? _q : spacing;
|
|
113
|
+
var endSpacing = (_r = props.endSpacing) !== null && _r !== void 0 ? _r : spacing;
|
|
114
|
+
var horizontal = (_s = props.horizontal) !== null && _s !== void 0 ? _s : BarDefaults.horizontal;
|
|
115
|
+
var rtl = (_t = props.rtl) !== null && _t !== void 0 ? _t : BarDefaults.rtl;
|
|
116
|
+
var yAxisAtTop = (_u = props.yAxisAtTop) !== null && _u !== void 0 ? _u : BarDefaults.yAxisAtTop;
|
|
117
|
+
var intactTopLabel = (_v = props.intactTopLabel) !== null && _v !== void 0 ? _v : BarDefaults.intactTopLabel;
|
|
117
118
|
var heightFromProps = horizontal ? props.width : props.height;
|
|
118
119
|
var widthFromProps = horizontal ? props.height : props.width;
|
|
119
|
-
var isAnimated = (
|
|
120
|
-
var animationDuration = (
|
|
120
|
+
var isAnimated = (_w = props.isAnimated) !== null && _w !== void 0 ? _w : BarDefaults.isAnimated;
|
|
121
|
+
var animationDuration = (_x = props.animationDuration) !== null && _x !== void 0 ? _x : BarDefaults.animationDuration;
|
|
121
122
|
// const secondaryData = getSecondaryDataWithOffsetIncluded(
|
|
122
123
|
// props.secondaryData,
|
|
123
124
|
// props.secondaryYAxis
|
|
@@ -135,7 +136,7 @@ export var useBarChart = function (props) {
|
|
|
135
136
|
return props.lineData;
|
|
136
137
|
}, [yAxisOffset, props.lineData, data, stackData]);
|
|
137
138
|
var lineData2 = props.lineData2;
|
|
138
|
-
var lineBehindBars = (
|
|
139
|
+
var lineBehindBars = (_y = props.lineBehindBars) !== null && _y !== void 0 ? _y : BarDefaults.lineBehindBars;
|
|
139
140
|
defaultLineConfig.initialSpacing = initialSpacing;
|
|
140
141
|
defaultLineConfig.endIndex = lineData.length - 1;
|
|
141
142
|
defaultLineConfig.animationDuration = animationDuration;
|
|
@@ -150,12 +151,12 @@ export var useBarChart = function (props) {
|
|
|
150
151
|
? props.stepHeight * noOfSections
|
|
151
152
|
: AxesAndRulesDefaults.containerHeight);
|
|
152
153
|
var horizSections = [{ value: '0' }];
|
|
153
|
-
var stepHeight = (
|
|
154
|
-
var labelWidth = (
|
|
155
|
-
var scrollToEnd = (
|
|
156
|
-
var scrollAnimation = (
|
|
157
|
-
var scrollEventThrottle = (
|
|
158
|
-
var labelsExtraHeight = (
|
|
154
|
+
var stepHeight = (_z = props.stepHeight) !== null && _z !== void 0 ? _z : containerHeight / noOfSections;
|
|
155
|
+
var labelWidth = (_0 = props.labelWidth) !== null && _0 !== void 0 ? _0 : AxesAndRulesDefaults.labelWidth;
|
|
156
|
+
var scrollToEnd = (_1 = props.scrollToEnd) !== null && _1 !== void 0 ? _1 : BarDefaults.scrollToEnd;
|
|
157
|
+
var scrollAnimation = (_2 = props.scrollAnimation) !== null && _2 !== void 0 ? _2 : BarDefaults.scrollAnimation;
|
|
158
|
+
var scrollEventThrottle = (_3 = props.scrollEventThrottle) !== null && _3 !== void 0 ? _3 : BarDefaults.scrollEventThrottle;
|
|
159
|
+
var labelsExtraHeight = (_4 = props.labelsExtraHeight) !== null && _4 !== void 0 ? _4 : AxesAndRulesDefaults.labelsExtraHeight;
|
|
159
160
|
var secondaryMaxItem = 0;
|
|
160
161
|
var secondaryMinItem = 0;
|
|
161
162
|
if (lineConfig.isSecondary) {
|
|
@@ -231,13 +232,13 @@ export var useBarChart = function (props) {
|
|
|
231
232
|
});
|
|
232
233
|
}
|
|
233
234
|
var valuesRange = maxItem - minPositiveItem; // Diff bw largest & smallest +ve values
|
|
234
|
-
var showFractionalValues = (
|
|
235
|
-
var roundToDigits = (
|
|
235
|
+
var showFractionalValues = (_5 = props.showFractionalValues) !== null && _5 !== void 0 ? _5 : valuesRange <= 1;
|
|
236
|
+
var roundToDigits = (_6 = props.roundToDigits) !== null && _6 !== void 0 ? _6 : (showFractionalValues ? indexOfFirstNonZeroDigit(valuesRange) + 1 : 0);
|
|
236
237
|
var maxAndMin = maxAndMinUtil(maxItem, minItem, roundToDigits, showFractionalValues);
|
|
237
238
|
var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxAndMin.maxItem) || 10;
|
|
238
239
|
var secondaryRange = secondaryMaxItem - secondaryMinPositiveItem; // Diff bw largest & smallest +ve values
|
|
239
|
-
var showSecondaryFractionalValues = (
|
|
240
|
-
var secondaryRoundToDigits = (
|
|
240
|
+
var showSecondaryFractionalValues = (_8 = (_7 = props.secondaryYAxis) === null || _7 === void 0 ? void 0 : _7.showFractionalValues) !== null && _8 !== void 0 ? _8 : secondaryRange <= 1;
|
|
241
|
+
var secondaryRoundToDigits = (_10 = (_9 = props.secondaryYAxis) === null || _9 === void 0 ? void 0 : _9.roundToDigits) !== null && _10 !== void 0 ? _10 : (showSecondaryFractionalValues
|
|
241
242
|
? indexOfFirstNonZeroDigit(secondaryRange) + 1
|
|
242
243
|
: 0);
|
|
243
244
|
var secondaryMaxAndMin = maxAndMinUtil(secondaryMaxItem, secondaryMinItem, secondaryRoundToDigits, showSecondaryFractionalValues);
|
|
@@ -247,88 +248,88 @@ export var useBarChart = function (props) {
|
|
|
247
248
|
// secondaryMaxAndMin.maxItem
|
|
248
249
|
// : secondaryMaxAndMin.maxItem
|
|
249
250
|
// : maxValue
|
|
250
|
-
var secondaryMaxValue = (
|
|
251
|
+
var secondaryMaxValue = (_12 = (_11 = props.secondaryYAxis) === null || _11 === void 0 ? void 0 : _11.maxValue) !== null && _12 !== void 0 ? _12 : secondaryMaxAndMin.maxItem;
|
|
251
252
|
var mostNegativeValue = getMostNegativeValue(props.mostNegativeValue, props.negativeStepValue, props.noOfSectionsBelowXAxis, maxAndMin.minItem);
|
|
252
|
-
var stepValue = (
|
|
253
|
+
var stepValue = (_13 = props.stepValue) !== null && _13 !== void 0 ? _13 : maxValue / noOfSections;
|
|
253
254
|
var effectiveNegativeStepValue = negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue;
|
|
254
|
-
var noOfSectionsBelowXAxis = (
|
|
255
|
+
var noOfSectionsBelowXAxis = (_14 = props.noOfSectionsBelowXAxis) !== null && _14 !== void 0 ? _14 : (effectiveNegativeStepValue
|
|
255
256
|
? Math.round(Math.ceil(-mostNegativeValue / effectiveNegativeStepValue))
|
|
256
257
|
: 0);
|
|
257
|
-
var showScrollIndicator = (
|
|
258
|
-
var side = (
|
|
259
|
-
var rotateLabel = (
|
|
260
|
-
var opacity = (
|
|
261
|
-
var isThreeD = (
|
|
262
|
-
var showXAxisIndices = (
|
|
263
|
-
var xAxisIndicesHeight = (
|
|
264
|
-
var xAxisIndicesWidth = (
|
|
265
|
-
var xAxisIndicesColor = (
|
|
266
|
-
var xAxisThickness = (
|
|
267
|
-
var xAxisTextNumberOfLines = (
|
|
268
|
-
var xAxisLabelsVerticalShift = (
|
|
269
|
-
var xAxisLabelsAtBottom = (
|
|
258
|
+
var showScrollIndicator = (_15 = props.showScrollIndicator) !== null && _15 !== void 0 ? _15 : BarDefaults.showScrollIndicator;
|
|
259
|
+
var side = (_16 = props.side) !== null && _16 !== void 0 ? _16 : BarDefaults.side;
|
|
260
|
+
var rotateLabel = (_17 = props.rotateLabel) !== null && _17 !== void 0 ? _17 : AxesAndRulesDefaults.rotateLabel;
|
|
261
|
+
var opacity = (_18 = props.opacity) !== null && _18 !== void 0 ? _18 : BarDefaults.opacity;
|
|
262
|
+
var isThreeD = (_19 = props.isThreeD) !== null && _19 !== void 0 ? _19 : BarDefaults.isThreeD;
|
|
263
|
+
var showXAxisIndices = (_20 = props.showXAxisIndices) !== null && _20 !== void 0 ? _20 : AxesAndRulesDefaults.showXAxisIndices;
|
|
264
|
+
var xAxisIndicesHeight = (_21 = props.xAxisIndicesHeight) !== null && _21 !== void 0 ? _21 : AxesAndRulesDefaults.xAxisIndicesHeight;
|
|
265
|
+
var xAxisIndicesWidth = (_22 = props.xAxisIndicesWidth) !== null && _22 !== void 0 ? _22 : AxesAndRulesDefaults.xAxisIndicesWidth;
|
|
266
|
+
var xAxisIndicesColor = (_23 = props.xAxisIndicesColor) !== null && _23 !== void 0 ? _23 : AxesAndRulesDefaults.xAxisIndicesColor;
|
|
267
|
+
var xAxisThickness = (_24 = props.xAxisThickness) !== null && _24 !== void 0 ? _24 : AxesAndRulesDefaults.xAxisThickness;
|
|
268
|
+
var xAxisTextNumberOfLines = (_25 = props.xAxisTextNumberOfLines) !== null && _25 !== void 0 ? _25 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
|
|
269
|
+
var xAxisLabelsVerticalShift = (_26 = props.xAxisLabelsVerticalShift) !== null && _26 !== void 0 ? _26 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
|
|
270
|
+
var xAxisLabelsAtBottom = (_27 = props.xAxisLabelsAtBottom) !== null && _27 !== void 0 ? _27 : false;
|
|
270
271
|
var horizontalRulesStyle = props.horizontalRulesStyle;
|
|
271
|
-
var autoShiftLabels = (
|
|
272
|
-
var barBorderColor = (
|
|
272
|
+
var autoShiftLabels = (_28 = props.autoShiftLabels) !== null && _28 !== void 0 ? _28 : false;
|
|
273
|
+
var barBorderColor = (_29 = props.barBorderColor) !== null && _29 !== void 0 ? _29 : BarDefaults.barBorderColor;
|
|
273
274
|
var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
|
|
274
275
|
var axesAndRulesProps = getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, roundToDigits, negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue, secondaryMaxValue, secondaryMinItem, showSecondaryFractionalValues, secondaryRoundToDigits);
|
|
275
|
-
var
|
|
276
|
-
var primary4thQuadrantHeight = noOfSectionsBelowXAxis * ((
|
|
276
|
+
var _75 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepHeight = _75.stepHeight, secondaryStepValue = _75.stepValue, secondaryNegativeStepHeight = _75.negativeStepHeight, secondaryNegativeStepValue = _75.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _75.noOfSectionsBelowXAxis;
|
|
277
|
+
var primary4thQuadrantHeight = noOfSectionsBelowXAxis * ((_30 = props.negativeStepHeight) !== null && _30 !== void 0 ? _30 : stepHeight);
|
|
277
278
|
var secondary4thQuadrantHeight = secondaryNoOfSectionsBelowXAxis * secondaryNegativeStepHeight;
|
|
278
279
|
var fourthQuadrantHeight = Math.max(primary4thQuadrantHeight, secondary4thQuadrantHeight);
|
|
279
280
|
var containerHeightIncludingBelowXAxis = extendedContainerHeight + fourthQuadrantHeight;
|
|
280
|
-
var
|
|
281
|
-
var
|
|
282
|
-
var
|
|
283
|
-
var
|
|
284
|
-
var
|
|
285
|
-
var
|
|
281
|
+
var _76 = __read(useState(-1), 2), pointerIndex = _76[0], setPointerIndex = _76[1];
|
|
282
|
+
var _77 = __read(useState(0), 2), pointerX = _77[0], setPointerX = _77[1];
|
|
283
|
+
var _78 = __read(useState(0), 2), pointerY = _78[0], setPointerY = _78[1];
|
|
284
|
+
var _79 = __read(useState(), 2), pointerItem = _79[0], setPointerItem = _79[1];
|
|
285
|
+
var _80 = __read(useState(0), 2), responderStartTime = _80[0], setResponderStartTime = _80[1];
|
|
286
|
+
var _81 = __read(useState(false), 2), responderActive = _81[0], setResponderActive = _81[1];
|
|
286
287
|
var pointerConfig = props.pointerConfig;
|
|
287
|
-
var getPointerProps = (
|
|
288
|
-
var pointerHeight = (
|
|
289
|
-
var pointerWidth = (
|
|
290
|
-
var pointerRadius = (
|
|
291
|
-
var pointerColor = (
|
|
292
|
-
var pointerComponent = (
|
|
288
|
+
var getPointerProps = (_31 = props.getPointerProps) !== null && _31 !== void 0 ? _31 : null;
|
|
289
|
+
var pointerHeight = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.height;
|
|
290
|
+
var pointerWidth = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.width;
|
|
291
|
+
var pointerRadius = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _34 !== void 0 ? _34 : defaultPointerConfig.radius;
|
|
292
|
+
var pointerColor = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _35 !== void 0 ? _35 : defaultPointerConfig.pointerColor;
|
|
293
|
+
var pointerComponent = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.pointerComponent;
|
|
293
294
|
var showPointerStrip = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.showPointerStrip) === false
|
|
294
295
|
? false
|
|
295
296
|
: defaultPointerConfig.showPointerStrip;
|
|
296
|
-
var pointerStripHeight = (
|
|
297
|
-
var pointerStripWidth = (
|
|
298
|
-
var pointerStripColor = (
|
|
299
|
-
var pointerStripUptoDataPoint = (
|
|
300
|
-
var pointerLabelComponent = (
|
|
301
|
-
var stripOverPointer = (
|
|
302
|
-
var shiftPointerLabelX = (
|
|
303
|
-
var shiftPointerLabelY = (
|
|
304
|
-
var pointerLabelWidth = (
|
|
305
|
-
var pointerLabelHeight = (
|
|
306
|
-
var autoAdjustPointerLabelPosition = (
|
|
307
|
-
var pointerVanishDelay = (
|
|
308
|
-
var activatePointersOnLongPress = (
|
|
309
|
-
var activatePointersDelay = (
|
|
310
|
-
var initialPointerIndex = (
|
|
311
|
-
var initialPointerAppearDelay = (
|
|
297
|
+
var pointerStripHeight = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.pointerStripHeight;
|
|
298
|
+
var pointerStripWidth = (_38 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _38 !== void 0 ? _38 : defaultPointerConfig.pointerStripWidth;
|
|
299
|
+
var pointerStripColor = (_39 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _39 !== void 0 ? _39 : defaultPointerConfig.pointerStripColor;
|
|
300
|
+
var pointerStripUptoDataPoint = (_40 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _40 !== void 0 ? _40 : defaultPointerConfig.pointerStripUptoDataPoint;
|
|
301
|
+
var pointerLabelComponent = (_41 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _41 !== void 0 ? _41 : defaultPointerConfig.pointerLabelComponent;
|
|
302
|
+
var stripOverPointer = (_42 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _42 !== void 0 ? _42 : defaultPointerConfig.stripOverPointer;
|
|
303
|
+
var shiftPointerLabelX = (_43 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _43 !== void 0 ? _43 : defaultPointerConfig.shiftPointerLabelX;
|
|
304
|
+
var shiftPointerLabelY = (_44 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _44 !== void 0 ? _44 : defaultPointerConfig.shiftPointerLabelY;
|
|
305
|
+
var pointerLabelWidth = (_45 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _45 !== void 0 ? _45 : defaultPointerConfig.pointerLabelWidth;
|
|
306
|
+
var pointerLabelHeight = (_46 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _46 !== void 0 ? _46 : defaultPointerConfig.pointerLabelHeight;
|
|
307
|
+
var autoAdjustPointerLabelPosition = (_47 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _47 !== void 0 ? _47 : defaultPointerConfig.autoAdjustPointerLabelPosition;
|
|
308
|
+
var pointerVanishDelay = (_48 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _48 !== void 0 ? _48 : defaultPointerConfig.pointerVanishDelay;
|
|
309
|
+
var activatePointersOnLongPress = (_49 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _49 !== void 0 ? _49 : defaultPointerConfig.activatePointersOnLongPress;
|
|
310
|
+
var activatePointersDelay = (_50 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _50 !== void 0 ? _50 : defaultPointerConfig.activatePointersDelay;
|
|
311
|
+
var initialPointerIndex = (_51 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _51 !== void 0 ? _51 : defaultPointerConfig.initialPointerIndex;
|
|
312
|
+
var initialPointerAppearDelay = (_52 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _52 !== void 0 ? _52 : (isAnimated
|
|
312
313
|
? animationDuration
|
|
313
314
|
: defaultPointerConfig.initialPointerAppearDelay);
|
|
314
|
-
var persistPointer = (
|
|
315
|
-
var hidePointer1 = (
|
|
315
|
+
var persistPointer = (_53 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _53 !== void 0 ? _53 : defaultPointerConfig.persistPointer;
|
|
316
|
+
var hidePointer1 = (_54 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _54 !== void 0 ? _54 : defaultPointerConfig.hidePointer1;
|
|
316
317
|
var pointerEvents = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerEvents;
|
|
317
|
-
var stripBehindBars = (
|
|
318
|
-
var disableScroll = (
|
|
318
|
+
var stripBehindBars = (_55 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _55 !== void 0 ? _55 : defaultPointerConfig.stripBehindBars;
|
|
319
|
+
var disableScroll = (_56 = props.disableScroll) !== null && _56 !== void 0 ? _56 : (pointerConfig
|
|
319
320
|
? activatePointersOnLongPress
|
|
320
321
|
? !!responderActive
|
|
321
322
|
: true
|
|
322
323
|
: false);
|
|
323
324
|
var yAxisExtraHeightAtTop = props.trimYAxisAtTop
|
|
324
325
|
? 0
|
|
325
|
-
: (
|
|
326
|
+
: (_57 = props.yAxisExtraHeight) !== null && _57 !== void 0 ? _57 : containerHeight / 20;
|
|
326
327
|
var barInnerComponent = props.barInnerComponent;
|
|
327
328
|
var localYAxisOffset1 = lineConfig.isSecondary
|
|
328
|
-
? (
|
|
329
|
+
? (_59 = (_58 = props.secondaryYAxis) === null || _58 === void 0 ? void 0 : _58.yAxisOffset) !== null && _59 !== void 0 ? _59 : 0
|
|
329
330
|
: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
|
|
330
331
|
var localYAxisOffset2 = lineConfig2.isSecondary
|
|
331
|
-
? (
|
|
332
|
+
? (_61 = (_60 = props.secondaryYAxis) === null || _60 === void 0 ? void 0 : _60.yAxisOffset) !== null && _61 !== void 0 ? _61 : 0
|
|
332
333
|
: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
|
|
333
334
|
useEffect(function () {
|
|
334
335
|
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;
|
|
@@ -444,9 +445,9 @@ export var useBarChart = function (props) {
|
|
|
444
445
|
spacing,
|
|
445
446
|
yAxisLabelWidth,
|
|
446
447
|
lineConfig.showArrow,
|
|
447
|
-
(
|
|
448
|
-
(
|
|
449
|
-
(
|
|
448
|
+
(_62 = lineConfig.arrowConfig) === null || _62 === void 0 ? void 0 : _62.length,
|
|
449
|
+
(_63 = lineConfig.arrowConfig) === null || _63 === void 0 ? void 0 : _63.width,
|
|
450
|
+
(_64 = lineConfig.arrowConfig) === null || _64 === void 0 ? void 0 : _64.showArrowBase
|
|
450
451
|
]);
|
|
451
452
|
useEffect(function () {
|
|
452
453
|
var _a, _b;
|
|
@@ -583,19 +584,19 @@ export var useBarChart = function (props) {
|
|
|
583
584
|
containerHeight: containerHeight,
|
|
584
585
|
noOfSectionsBelowXAxis: noOfSectionsBelowXAxis,
|
|
585
586
|
stepHeight: stepHeight,
|
|
586
|
-
negativeStepHeight: (
|
|
587
|
+
negativeStepHeight: (_65 = props.negativeStepHeight) !== null && _65 !== void 0 ? _65 : stepHeight,
|
|
587
588
|
labelsExtraHeight: labelsExtraHeight,
|
|
588
589
|
yAxisLabelWidth: yAxisLabelWidth,
|
|
589
590
|
horizontal: horizontal,
|
|
590
591
|
rtl: rtl,
|
|
591
|
-
shiftX: (
|
|
592
|
-
shiftY: (
|
|
592
|
+
shiftX: (_66 = props.shiftX) !== null && _66 !== void 0 ? _66 : 0,
|
|
593
|
+
shiftY: (_67 = props.shiftY) !== null && _67 !== void 0 ? _67 : 0,
|
|
593
594
|
yAxisAtTop: yAxisAtTop,
|
|
594
595
|
initialSpacing: initialSpacing,
|
|
595
596
|
data: data,
|
|
596
597
|
stackData: stackData,
|
|
597
598
|
// secondaryData,
|
|
598
|
-
barWidth: (
|
|
599
|
+
barWidth: (_68 = props.barWidth) !== null && _68 !== void 0 ? _68 : defaultBarWidth,
|
|
599
600
|
xAxisThickness: xAxisThickness,
|
|
600
601
|
totalWidth: totalWidth,
|
|
601
602
|
disableScroll: disableScroll,
|
|
@@ -644,13 +645,15 @@ export var useBarChart = function (props) {
|
|
|
644
645
|
pointerY: pointerY,
|
|
645
646
|
onEndReached: props.onEndReached,
|
|
646
647
|
onStartReached: props.onStartReached,
|
|
647
|
-
endReachedOffset: (
|
|
648
|
+
endReachedOffset: (_69 = props.endReachedOffset) !== null && _69 !== void 0 ? _69 : BarDefaults.endReachedOffset,
|
|
648
649
|
onMomentumScrollEnd: props.onMomentumScrollEnd,
|
|
649
650
|
customBackground: props.customBackground,
|
|
650
651
|
highlightEnabled: highlightEnabled,
|
|
651
652
|
lowlightOpacity: lowlightOpacity,
|
|
652
653
|
xAxisLabelsAtBottom: xAxisLabelsAtBottom,
|
|
653
|
-
onScrollEndDrag: props.onScrollEndDrag
|
|
654
|
+
onScrollEndDrag: props.onScrollEndDrag,
|
|
655
|
+
floatingYAxisLabels: floatingYAxisLabels,
|
|
656
|
+
allowFontScaling: allowFontScaling
|
|
654
657
|
};
|
|
655
658
|
return {
|
|
656
659
|
lineConfig: lineConfig,
|
|
@@ -763,6 +766,7 @@ export var useBarChart = function (props) {
|
|
|
763
766
|
barAndLineChartsWrapperProps: barAndLineChartsWrapperProps,
|
|
764
767
|
yAxisExtraHeightAtTop: yAxisExtraHeightAtTop,
|
|
765
768
|
selectedStackIndex: selectedStackIndex,
|
|
766
|
-
setSelectedStackIndex: setSelectedStackIndex
|
|
769
|
+
setSelectedStackIndex: setSelectedStackIndex,
|
|
770
|
+
allowFontScaling: allowFontScaling
|
|
767
771
|
};
|
|
768
772
|
};
|
package/dist/BarChart/types.d.ts
CHANGED
|
@@ -195,6 +195,8 @@ export interface BarChartPropsType {
|
|
|
195
195
|
xAxisLabelsVerticalShift?: number;
|
|
196
196
|
xAxisLabelsAtBottom?: boolean;
|
|
197
197
|
yAxisLabelWidth?: number;
|
|
198
|
+
floatingYAxisLabels?: boolean;
|
|
199
|
+
allowFontScaling?: boolean;
|
|
198
200
|
hideYAxisText?: boolean;
|
|
199
201
|
rotateYAxisTexts?: number;
|
|
200
202
|
yAxisSide?: yAxisSides;
|
|
@@ -663,6 +665,7 @@ export interface animatedBarPropTypes {
|
|
|
663
665
|
selectedIndex: number[];
|
|
664
666
|
focusBarOnPress?: boolean;
|
|
665
667
|
focusedBarConfig?: FocusedBarConfig;
|
|
668
|
+
containerHeight: number;
|
|
666
669
|
}
|
|
667
670
|
export interface CommonPropsFor2dand3dBarsType {
|
|
668
671
|
barBackgroundPattern?: () => ReactNode;
|