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/PieChart/index.js
CHANGED
|
@@ -18,10 +18,10 @@ import { useEffect, useState } from 'react';
|
|
|
18
18
|
import { getTextSizeForPieLabels } from '../utils';
|
|
19
19
|
import { PieTooltipDefaults } from '../utils/constants';
|
|
20
20
|
export var usePieChart = function (props) {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
22
|
-
var showTooltip = props.showTooltip, tooltipWidth = props.tooltipWidth, tooltipComponent = props.tooltipComponent,
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
22
|
+
var showTooltip = props.showTooltip, tooltipWidth = props.tooltipWidth, tooltipComponent = props.tooltipComponent, _v = props.tooltipVerticalShift, tooltipVerticalShift = _v === void 0 ? PieTooltipDefaults.tooltipVerticalShift : _v, _w = props.tooltipHorizontalShift, tooltipHorizontalShift = _w === void 0 ? PieTooltipDefaults.tooltipHorizontalShift : _w, _x = props.showValuesAsTooltipText, showValuesAsTooltipText = _x === void 0 ? PieTooltipDefaults.showValuesAsTooltipText : _x, _y = props.tooltipTextNoOfLines, tooltipTextNoOfLines = _y === void 0 ? PieTooltipDefaults.tooltipTextNoOfLines : _y, _z = props.tooltipBackgroundColor, tooltipBackgroundColor = _z === void 0 ? PieTooltipDefaults.tooltipBackgroundColor : _z, _0 = props.tooltipBorderRadius, tooltipBorderRadius = _0 === void 0 ? PieTooltipDefaults.tooltipBorderRadius : _0, textColor = props.textColor,
|
|
23
23
|
// textSize,
|
|
24
|
-
font = props.font, fontWeight = props.fontWeight, fontStyle = props.fontStyle;
|
|
24
|
+
font = props.font, fontWeight = props.fontWeight, fontStyle = props.fontStyle, initialAngle = props.initialAngle, _1 = props.rotatable, rotatable = _1 === void 0 ? false : _1;
|
|
25
25
|
var _2 = __read(useState(-1), 2), tooltipSelectedIndex = _2[0], setTooltipSelectedIndex = _2[1];
|
|
26
26
|
var radius = (_a = props.radius) !== null && _a !== void 0 ? _a : 120;
|
|
27
27
|
var extraRadius = (_b = props.extraRadius) !== null && _b !== void 0 ? _b : (props.showExternalLabels
|
|
@@ -32,25 +32,26 @@ export var usePieChart = function (props) {
|
|
|
32
32
|
var pi = props.semiCircle ? Math.PI / 2 : Math.PI;
|
|
33
33
|
var _3 = __read(useState((_d = props.focusedPieIndex) !== null && _d !== void 0 ? _d : -1), 2), selectedIndex = _3[0], setSelectedIndex = _3[1]; // at the start, nothing is selected
|
|
34
34
|
// because we're going to use a useEffect, we need startAngle and total to be state variables
|
|
35
|
-
var _4 = __read(useState(
|
|
35
|
+
var _4 = __read(useState(initialAngle !== null && initialAngle !== void 0 ? initialAngle : (props.semiCircle ? -pi : 0)), 2), startAngle = _4[0], setStartAngle = _4[1];
|
|
36
36
|
var _5 = __read(useState(0), 2), total = _5[0], setTotal = _5[1];
|
|
37
37
|
useEffect(function () {
|
|
38
38
|
var _a;
|
|
39
39
|
setSelectedIndex((_a = props.focusedPieIndex) !== null && _a !== void 0 ? _a : -1);
|
|
40
40
|
}, [props.focusedPieIndex]);
|
|
41
41
|
useEffect(function () {
|
|
42
|
-
var _a;
|
|
43
42
|
// Update the total, this could be use to replace the forEach : const newTotal = props.data.reduce((acc, item) => acc + item.value, 0);
|
|
44
43
|
var newTotal = 0;
|
|
45
|
-
props.data.forEach(function (item) {
|
|
44
|
+
props.data.forEach(function (item, index) {
|
|
46
45
|
newTotal += item.value;
|
|
46
|
+
if (index === props.focusedPieIndex)
|
|
47
|
+
item.focused = true;
|
|
47
48
|
});
|
|
48
49
|
setTotal(newTotal);
|
|
49
50
|
// Update selectedIndex based on focused item
|
|
50
51
|
var newSelectedIndex = props.data.findIndex(function (item) { return item.focused === true; });
|
|
51
52
|
setSelectedIndex(newSelectedIndex);
|
|
52
53
|
// Calculate the new start angle
|
|
53
|
-
var newStartAngle =
|
|
54
|
+
var newStartAngle = initialAngle !== null && initialAngle !== void 0 ? initialAngle : (props.semiCircle ? -pi : 0);
|
|
54
55
|
if (newSelectedIndex !== -1) {
|
|
55
56
|
// it was !== 0 here before, which would not work, it's either !==-1 or >=0
|
|
56
57
|
// This could be used to replace the for loop that was used before
|
|
@@ -62,14 +63,14 @@ export var usePieChart = function (props) {
|
|
|
62
63
|
else {
|
|
63
64
|
setStartAngle(newStartAngle);
|
|
64
65
|
}
|
|
65
|
-
}, [props.data,
|
|
66
|
+
}, [props.data, initialAngle, props.semiCircle]);
|
|
66
67
|
useEffect(function () {
|
|
67
|
-
var _a;
|
|
68
|
+
var _a, _b;
|
|
68
69
|
if (selectedIndex !== -1) {
|
|
69
|
-
var newStartAngle =
|
|
70
|
+
var newStartAngle = initialAngle !== null && initialAngle !== void 0 ? initialAngle : (props.semiCircle ? -pi : 0);
|
|
70
71
|
var start = 0;
|
|
71
72
|
for (var i = 0; i < selectedIndex; i++) {
|
|
72
|
-
start += props.data[i].value;
|
|
73
|
+
start += (_b = (_a = props.data[i]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0;
|
|
73
74
|
}
|
|
74
75
|
if (total) {
|
|
75
76
|
setStartAngle(newStartAngle + (2 * pi * start) / (total || 1));
|
|
@@ -77,29 +78,29 @@ export var usePieChart = function (props) {
|
|
|
77
78
|
}
|
|
78
79
|
}, [selectedIndex]);
|
|
79
80
|
var pro = props.pro, data = props.data, donut = props.donut, isThreeD = props.isThreeD, semiCircle = props.semiCircle, _6 = props.inwardExtraLengthForFocused, inwardExtraLengthForFocused = _6 === void 0 ? 0 : _6, _7 = props.isAnimated, isAnimated = _7 === void 0 ? false : _7, edgesRadius = props.edgesRadius;
|
|
80
|
-
var endAngle = (
|
|
81
|
+
var endAngle = (_e = props.endAngle) !== null && _e !== void 0 ? _e : startAngle + Math.PI * (semiCircle ? 1 : 2);
|
|
81
82
|
var canvasWidth = radius * 2;
|
|
82
83
|
var canvasHeight = isThreeD ? radius * 2.3 : radius * 2;
|
|
83
|
-
var strokeWidth = (
|
|
84
|
-
var innerRadius = (
|
|
85
|
-
var innerCircleColor = (
|
|
86
|
-
var innerCircleBorderWidth = (
|
|
87
|
-
var innerCircleBorderColor = (
|
|
88
|
-
var shiftInnerCenterX = (
|
|
89
|
-
var shiftInnerCenterY = (
|
|
90
|
-
var tiltAngle = (
|
|
84
|
+
var strokeWidth = (_f = props.strokeWidth) !== null && _f !== void 0 ? _f : 0;
|
|
85
|
+
var innerRadius = (_g = props.innerRadius) !== null && _g !== void 0 ? _g : radius / 2.5;
|
|
86
|
+
var innerCircleColor = (_j = (_h = props.innerCircleColor) !== null && _h !== void 0 ? _h : props.backgroundColor) !== null && _j !== void 0 ? _j : 'white';
|
|
87
|
+
var innerCircleBorderWidth = (_k = props.innerCircleBorderWidth) !== null && _k !== void 0 ? _k : (props.innerCircleBorderColor ? strokeWidth || 2 : 0);
|
|
88
|
+
var innerCircleBorderColor = (_l = props.innerCircleBorderColor) !== null && _l !== void 0 ? _l : 'lightgray';
|
|
89
|
+
var shiftInnerCenterX = (_m = props.shiftInnerCenterX) !== null && _m !== void 0 ? _m : 0;
|
|
90
|
+
var shiftInnerCenterY = (_o = props.shiftInnerCenterY) !== null && _o !== void 0 ? _o : 0;
|
|
91
|
+
var tiltAngle = (_p = props.tiltAngle) !== null && _p !== void 0 ? _p : '55deg';
|
|
91
92
|
var isDataShifted = false;
|
|
92
93
|
data.forEach(function (item) {
|
|
93
94
|
if (item.shiftX || item.shiftY) {
|
|
94
95
|
isDataShifted = true;
|
|
95
96
|
}
|
|
96
97
|
});
|
|
97
|
-
var textSize = getTextSizeForPieLabels((
|
|
98
|
-
var paddingHorizontal = ((
|
|
99
|
-
? ((
|
|
98
|
+
var textSize = getTextSizeForPieLabels((_q = props.textSize) !== null && _q !== void 0 ? _q : 0, radius);
|
|
99
|
+
var paddingHorizontal = ((_r = props.paddingHorizontal) !== null && _r !== void 0 ? _r : props.labelsPosition === 'onBorder')
|
|
100
|
+
? ((_s = props.textBackgroundRadius) !== null && _s !== void 0 ? _s : textSize) * 2 + 6
|
|
100
101
|
: 0;
|
|
101
|
-
var paddingVertical = ((
|
|
102
|
-
? ((
|
|
102
|
+
var paddingVertical = ((_t = props.paddingVertical) !== null && _t !== void 0 ? _t : props.labelsPosition === 'onBorder')
|
|
103
|
+
? ((_u = props.textBackgroundRadius) !== null && _u !== void 0 ? _u : textSize) * 2 + 6
|
|
103
104
|
: 0;
|
|
104
105
|
var getTooltipText = function (index) {
|
|
105
106
|
var _a, _b;
|
|
@@ -151,6 +152,7 @@ export var usePieChart = function (props) {
|
|
|
151
152
|
fontWeight: fontWeight,
|
|
152
153
|
fontStyle: fontStyle,
|
|
153
154
|
tooltipSelectedIndex: tooltipSelectedIndex,
|
|
154
|
-
setTooltipSelectedIndex: setTooltipSelectedIndex
|
|
155
|
+
setTooltipSelectedIndex: setTooltipSelectedIndex,
|
|
156
|
+
rotatable: rotatable
|
|
155
157
|
};
|
|
156
158
|
};
|
package/dist/PieChart/pro.js
CHANGED
|
@@ -26,8 +26,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
26
26
|
import { defaultAnimationDuration } from '../utils/constants';
|
|
27
27
|
export var usePiePro = function (props) {
|
|
28
28
|
var _a, _b;
|
|
29
|
-
var data = props.data, isAnimated = props.isAnimated, donut = props.donut, semiCircle = props.semiCircle, _c = props.radius, radius = _c === void 0 ? 120 : _c, _d = props.innerRadius, innerRadius = _d === void 0 ? donut ? radius / 2.5 : 0 : _d, _e = props.strokeWidth, strokeWidth = _e === void 0 ? props.ring ? 10 : 0 : _e, _f = props.edgesRadius, edgesRadius = _f === void 0 ? 0 : _f, _g = props.
|
|
30
|
-
var endAngle = (_a = props.endAngle) !== null && _a !== void 0 ? _a :
|
|
29
|
+
var data = props.data, isAnimated = props.isAnimated, donut = props.donut, semiCircle = props.semiCircle, _c = props.radius, radius = _c === void 0 ? 120 : _c, _d = props.innerRadius, innerRadius = _d === void 0 ? donut ? radius / 2.5 : 0 : _d, _e = props.strokeWidth, strokeWidth = _e === void 0 ? props.ring ? 10 : 0 : _e, _f = props.edgesRadius, edgesRadius = _f === void 0 ? 0 : _f, _g = props.initialAngle, initialAngle = _g === void 0 ? 0 : _g, ring = props.ring;
|
|
30
|
+
var endAngle = (_a = props.endAngle) !== null && _a !== void 0 ? _a : initialAngle + Math.PI * (semiCircle ? 1 : 2);
|
|
31
31
|
var total = data.reduce(function (acc, item) { return acc + (item === null || item === void 0 ? void 0 : item.value); }, 0);
|
|
32
32
|
var animationDuration = (_b = props.animationDuration) !== null && _b !== void 0 ? _b : defaultAnimationDuration;
|
|
33
33
|
var maxStrokeWidth = Math.max.apply(Math, __spreadArray(__spreadArray([], __read(data.map(function (item) { var _a; return (_a = item.strokeWidth) !== null && _a !== void 0 ? _a : 0; })), false), [strokeWidth], false));
|
|
@@ -56,7 +56,7 @@ export var usePiePro = function (props) {
|
|
|
56
56
|
var getCoordinates = function (index, additionalValue, addInOnlyStart, addInOnlyEnd, totalParam) {
|
|
57
57
|
var _a;
|
|
58
58
|
var addedValue = addValues(index - 1) + (addInOnlyEnd ? 0 : additionalValue !== null && additionalValue !== void 0 ? additionalValue : 0);
|
|
59
|
-
var angle = (addedValue / (totalParam !== null && totalParam !== void 0 ? totalParam : total)) * endAngle +
|
|
59
|
+
var angle = (addedValue / (totalParam !== null && totalParam !== void 0 ? totalParam : total)) * endAngle + initialAngle;
|
|
60
60
|
var startInnerX = radius + Math.cos(angle) * innerRadius;
|
|
61
61
|
var startInnerY = radius - Math.sin(angle) * innerRadius;
|
|
62
62
|
var startOuterX = radius + Math.cos(angle) * radius;
|
|
@@ -64,7 +64,7 @@ export var usePiePro = function (props) {
|
|
|
64
64
|
var value = addValues(index - 1) +
|
|
65
65
|
((_a = data[index]) === null || _a === void 0 ? void 0 : _a.value) +
|
|
66
66
|
(addInOnlyStart ? 0 : additionalValue !== null && additionalValue !== void 0 ? additionalValue : 0);
|
|
67
|
-
angle = (value / (totalParam !== null && totalParam !== void 0 ? totalParam : total)) * endAngle +
|
|
67
|
+
angle = (value / (totalParam !== null && totalParam !== void 0 ? totalParam : total)) * endAngle + initialAngle;
|
|
68
68
|
var endOuterX = radius + Math.cos(angle) * radius;
|
|
69
69
|
var endOuterY = radius - Math.sin(angle) * radius;
|
|
70
70
|
var endInnerX = radius + Math.cos(angle) * innerRadius;
|
|
@@ -83,7 +83,7 @@ export var usePiePro = function (props) {
|
|
|
83
83
|
var getTextCoordinates = function (index, labelPos) {
|
|
84
84
|
var _a;
|
|
85
85
|
var value = addValues(index - 1) + ((_a = data[index]) === null || _a === void 0 ? void 0 : _a.value) / 2;
|
|
86
|
-
var angle = (value / total) * endAngle +
|
|
86
|
+
var angle = (value / total) * endAngle + initialAngle;
|
|
87
87
|
var labelPosition = labelPos || labelsPosition;
|
|
88
88
|
var x = radius +
|
|
89
89
|
Math.cos(angle) *
|
package/dist/PieChart/types.d.ts
CHANGED
|
@@ -62,7 +62,6 @@ export interface PieChartPropsType {
|
|
|
62
62
|
pieInnerComponentWidth?: number;
|
|
63
63
|
paddingHorizontal?: number;
|
|
64
64
|
paddingVertical?: number;
|
|
65
|
-
startAngle?: number;
|
|
66
65
|
endAngle?: number;
|
|
67
66
|
curvedStartEdges?: boolean;
|
|
68
67
|
curvedEndEdges?: boolean;
|
|
@@ -77,6 +76,7 @@ export interface PieChartPropsType {
|
|
|
77
76
|
* @description If true, the edges of the pie will be pressable, but you may need to press twice for focus- once for unfocusing the already focused pie and then for focusing the new pie
|
|
78
77
|
*/
|
|
79
78
|
edgesPressable?: boolean;
|
|
79
|
+
rotatable?: boolean;
|
|
80
80
|
}
|
|
81
81
|
export interface pieDataItem {
|
|
82
82
|
value: number;
|
|
@@ -5,6 +5,13 @@ export declare const useRadarChart: (props: RadarChartProps) => {
|
|
|
5
5
|
center: number;
|
|
6
6
|
radius: number;
|
|
7
7
|
chartSize: number;
|
|
8
|
+
chartContainerProps: {
|
|
9
|
+
height: number;
|
|
10
|
+
width: number;
|
|
11
|
+
shiftX: number;
|
|
12
|
+
shiftY: number;
|
|
13
|
+
backgroundColor: import("react-native").ColorValue;
|
|
14
|
+
};
|
|
8
15
|
noOfSections: number;
|
|
9
16
|
polarToCartesian: (angle: number, value: number) => {
|
|
10
17
|
x: number;
|
package/dist/RadarChart/index.js
CHANGED
|
@@ -36,17 +36,24 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
36
36
|
};
|
|
37
37
|
import { radarChartDefaults } from '../utils/constants';
|
|
38
38
|
export var useRadarChart = function (props) {
|
|
39
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
40
|
-
var
|
|
41
|
-
var
|
|
39
|
+
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;
|
|
40
|
+
var _4 = props.circular, circular = _4 === void 0 ? false : _4, _5 = props.gridConfig, gridConfig = _5 === void 0 ? {} : _5, _6 = props.polygonConfig, polygonConfig = _6 === void 0 ? {} : _6, _7 = props.data, data = _7 === void 0 ? [] : _7, dataSet = props.dataSet, _8 = props.noOfSections, noOfSections = _8 === void 0 ? radarChartDefaults.noOfSections : _8, _9 = props.chartSize, chartSize = _9 === void 0 ? radarChartDefaults.chartSize : _9, _10 = props.labelConfig, labelConfig = _10 === void 0 ? {} : _10, labelConfigArray = props.labelConfigArray, _11 = props.asterLinesConfig, asterLinesConfig = _11 === void 0 ? {} : _11, _12 = props.hideGrid, hideGrid = _12 === void 0 ? radarChartDefaults.hideGrid : _12, _13 = props.hideLabels, hideLabels = _13 === void 0 ? radarChartDefaults.hideLabels : _13, _14 = props.hideAsterLines, hideAsterLines = _14 === void 0 ? (_a = props.hideGrid) !== null && _a !== void 0 ? _a : radarChartDefaults.hideAsterLines : _14, _15 = props.dataLabelsConfig, dataLabelsConfig = _15 === void 0 ? {} : _15, _16 = props.labelsPositionOffset, labelsPositionOffset = _16 === void 0 ? radarChartDefaults.labelsPositionOffset : _16, _17 = props.dataLabelsPositionOffset, dataLabelsPositionOffset = _17 === void 0 ? radarChartDefaults.dataLabelsPositionOffset : _17, _18 = props.isAnimated, isAnimated = _18 === void 0 ? radarChartDefaults.isAnimated : _18, _19 = props.animationDuration, animationDuration = _19 === void 0 ? radarChartDefaults.animationDuration : _19, _20 = props.animateTogether, animateTogether = _20 === void 0 ? radarChartDefaults.animateTogether : _20, _21 = props.startAngle, startAngle = _21 === void 0 ? radarChartDefaults.startAngle : _21, _22 = props.isClockWise, isClockWise = _22 === void 0 ? radarChartDefaults.isClockWise : _22;
|
|
41
|
+
var chartContainerProps = {
|
|
42
|
+
height: (_c = (_b = props.chartContainerProps) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : chartSize,
|
|
43
|
+
width: (_e = (_d = props.chartContainerProps) === null || _d === void 0 ? void 0 : _d.width) !== null && _e !== void 0 ? _e : chartSize,
|
|
44
|
+
shiftX: (_g = (_f = props.chartContainerProps) === null || _f === void 0 ? void 0 : _f.shiftX) !== null && _g !== void 0 ? _g : radarChartDefaults.chartContainerProps.shiftX,
|
|
45
|
+
shiftY: (_j = (_h = props.chartContainerProps) === null || _h === void 0 ? void 0 : _h.shiftY) !== null && _j !== void 0 ? _j : radarChartDefaults.chartContainerProps.shiftY,
|
|
46
|
+
backgroundColor: (_l = (_k = props.chartContainerProps) === null || _k === void 0 ? void 0 : _k.backgroundColor) !== null && _l !== void 0 ? _l : radarChartDefaults.chartContainerProps.backgroundColor
|
|
47
|
+
};
|
|
48
|
+
var labels = (_q = (_m = props.labels) !== null && _m !== void 0 ? _m : (_p = ((_o = dataSet === null || dataSet === void 0 ? void 0 : dataSet[0]) !== null && _o !== void 0 ? _o : data)) === null || _p === void 0 ? void 0 : _p.map(function (_, index) { return "Label".concat(index + 1); })) !== null && _q !== void 0 ? _q : [];
|
|
42
49
|
var getMax = function (dataSet) {
|
|
43
50
|
return dataSet.reduce(function (acc, set) {
|
|
44
51
|
var max = Math.max.apply(Math, __spreadArray([], __read(set), false));
|
|
45
52
|
return max > acc ? max : acc;
|
|
46
53
|
}, 0);
|
|
47
54
|
};
|
|
48
|
-
var maxValue = (
|
|
49
|
-
var dataLabels = (
|
|
55
|
+
var maxValue = (_r = props.maxValue) !== null && _r !== void 0 ? _r : (dataSet ? Math.max(getMax(dataSet !== null && dataSet !== void 0 ? dataSet : [])) : Math.max.apply(Math, __spreadArray([], __read((data !== null && data !== void 0 ? data : [])), false)));
|
|
56
|
+
var dataLabels = (_s = props.dataLabels) !== null && _s !== void 0 ? _s : (polygonConfig.showDataValuesAsLabels
|
|
50
57
|
? data.map(function (d) { return d.toString(); })
|
|
51
58
|
: null);
|
|
52
59
|
var polarToCartesian = function (angle, value) {
|
|
@@ -58,32 +65,32 @@ export var useRadarChart = function (props) {
|
|
|
58
65
|
};
|
|
59
66
|
var center = chartSize / 2;
|
|
60
67
|
var radius = center * 0.8;
|
|
61
|
-
var
|
|
62
|
-
.strokeDashArray :
|
|
63
|
-
.gradientColor :
|
|
64
|
-
.showGradient :
|
|
65
|
-
.gradientOpacity :
|
|
66
|
-
var gridSections = (
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
dataLabelsColor =
|
|
71
|
-
|
|
72
|
-
dataLabelsTextAnchor =
|
|
73
|
-
|
|
74
|
-
dataLabelsAlignmentBaseline =
|
|
75
|
-
|
|
76
|
-
dataLabelsFontWeight =
|
|
77
|
-
|
|
68
|
+
var _23 = gridConfig.stroke, gridStroke = _23 === void 0 ? radarChartDefaults.gridSection.stroke : _23, _24 = gridConfig.strokeWidth, gridStrokeWidth = _24 === void 0 ? radarChartDefaults.gridSection.strokeWidth : _24, _25 = gridConfig.strokeDashArray, gridStrokeDashArray = _25 === void 0 ? radarChartDefaults.gridSection
|
|
69
|
+
.strokeDashArray : _25, _26 = gridConfig.fill, gridFill = _26 === void 0 ? radarChartDefaults.gridSection.fill : _26, _27 = gridConfig.gradientColor, gridGradientColor = _27 === void 0 ? radarChartDefaults.gridSection
|
|
70
|
+
.gradientColor : _27, _28 = gridConfig.showGradient, gridShowGradient = _28 === void 0 ? radarChartDefaults.gridSection
|
|
71
|
+
.showGradient : _28, _29 = gridConfig.opacity, gridOpacity = _29 === void 0 ? radarChartDefaults.gridSection.opacity : _29, _30 = gridConfig.gradientOpacity, gridGradientOpacity = _30 === void 0 ? radarChartDefaults.gridSection
|
|
72
|
+
.gradientOpacity : _30;
|
|
73
|
+
var gridSections = (_u = (_t = gridConfig.gridSections) === null || _t === void 0 ? void 0 : _t.map(function (i) { return (__assign(__assign({}, radarChartDefaults.gridSection), i)); })) !== null && _u !== void 0 ? _u : Array(noOfSections).fill({});
|
|
74
|
+
var _31 = labelConfig.fontSize, fontSize = _31 === void 0 ? radarChartDefaults.labelConfig.fontSize : _31, _32 = labelConfig.stroke, stroke = _32 === void 0 ? radarChartDefaults.labelConfig.stroke : _32, _33 = labelConfig.textAnchor, textAnchor = _33 === void 0 ? radarChartDefaults.labelConfig.textAnchor : _33, _34 = labelConfig.alignmentBaseline, alignmentBaseline = _34 === void 0 ? radarChartDefaults.labelConfig.alignmentBaseline : _34, _35 = labelConfig.fontWeight, fontWeight = _35 === void 0 ? radarChartDefaults.labelConfig.fontWeight : _35, _36 = labelConfig.fontFamily, fontFamily = _36 === void 0 ? radarChartDefaults.labelConfig.fontFamily : _36;
|
|
75
|
+
var _37 = dataLabelsConfig.fontSize, dataLabelsFontSize = _37 === void 0 ? fontSize : _37, // defaults to labelConfig (from above)
|
|
76
|
+
_38 = dataLabelsConfig.stroke, // defaults to labelConfig (from above)
|
|
77
|
+
dataLabelsColor = _38 === void 0 ? stroke : _38, // defaults to labelConfig (from above)
|
|
78
|
+
_39 = dataLabelsConfig.textAnchor, // defaults to labelConfig (from above)
|
|
79
|
+
dataLabelsTextAnchor = _39 === void 0 ? textAnchor : _39, // defaults to labelConfig (from above)
|
|
80
|
+
_40 = dataLabelsConfig.alignmentBaseline, // defaults to labelConfig (from above)
|
|
81
|
+
dataLabelsAlignmentBaseline = _40 === void 0 ? alignmentBaseline : _40, // defaults to labelConfig (from above)
|
|
82
|
+
_41 = dataLabelsConfig.fontWeight, // defaults to labelConfig (from above)
|
|
83
|
+
dataLabelsFontWeight = _41 === void 0 ? fontWeight : _41, // defaults to labelConfig (from above)
|
|
84
|
+
_42 = dataLabelsConfig.fontFamily // defaults to labelConfig (from above)
|
|
78
85
|
, // defaults to labelConfig (from above)
|
|
79
|
-
dataLabelsFontFamily =
|
|
86
|
+
dataLabelsFontFamily = _42 === void 0 ? fontFamily : _42 // defaults to labelConfig (from above)
|
|
80
87
|
;
|
|
81
|
-
var
|
|
82
|
-
.strokeWidth :
|
|
83
|
-
.strokeDashArray :
|
|
84
|
-
.gradientColor :
|
|
85
|
-
.showGradient :
|
|
86
|
-
var polygonConfigArray = (
|
|
88
|
+
var _43 = polygonConfig.stroke, polygonStroke = _43 === void 0 ? radarChartDefaults.polygonConfig.stroke : _43, _44 = polygonConfig.strokeWidth, polygonStrokeWidth = _44 === void 0 ? radarChartDefaults.polygonConfig
|
|
89
|
+
.strokeWidth : _44, _45 = polygonConfig.strokeDashArray, polygonStrokeDashArray = _45 === void 0 ? radarChartDefaults.polygonConfig
|
|
90
|
+
.strokeDashArray : _45, _46 = polygonConfig.fill, polygonFill = _46 === void 0 ? radarChartDefaults.polygonConfig.fill : _46, _47 = polygonConfig.gradientColor, polygonGradientColor = _47 === void 0 ? radarChartDefaults.polygonConfig
|
|
91
|
+
.gradientColor : _47, _48 = polygonConfig.showGradient, polygonShowGradient = _48 === void 0 ? radarChartDefaults.polygonConfig
|
|
92
|
+
.showGradient : _48, _49 = polygonConfig.opacity, polygonOpacity = _49 === void 0 ? radarChartDefaults.polygonConfig.opacity : _49, _50 = polygonConfig.gradientOpacity, polygonGradientOpacity = _50 === void 0 ? polygonOpacity : _50, showDataValuesAsLabels = polygonConfig.showDataValuesAsLabels, _51 = polygonConfig.isAnimated, polygonIsAnimated = _51 === void 0 ? isAnimated : _51, _52 = polygonConfig.animationDuration, polygonAnimationDuration = _52 === void 0 ? animationDuration : _52;
|
|
93
|
+
var polygonConfigArray = (_w = (_v = props.polygonConfigArray) === null || _v === void 0 ? void 0 : _v.map(function (set) {
|
|
87
94
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
88
95
|
return ({
|
|
89
96
|
stroke: (_a = set.stroke) !== null && _a !== void 0 ? _a : polygonStroke,
|
|
@@ -98,7 +105,7 @@ export var useRadarChart = function (props) {
|
|
|
98
105
|
isAnimated: (_k = set.isAnimated) !== null && _k !== void 0 ? _k : polygonIsAnimated,
|
|
99
106
|
animationDuration: (_l = set.animationDuration) !== null && _l !== void 0 ? _l : polygonAnimationDuration
|
|
100
107
|
});
|
|
101
|
-
})) !== null &&
|
|
108
|
+
})) !== null && _w !== void 0 ? _w : (dataSet
|
|
102
109
|
? Array(dataSet.length).fill({
|
|
103
110
|
stroke: polygonStroke,
|
|
104
111
|
strokeWidth: polygonStrokeWidth,
|
|
@@ -113,10 +120,10 @@ export var useRadarChart = function (props) {
|
|
|
113
120
|
animationDuration: polygonAnimationDuration
|
|
114
121
|
})
|
|
115
122
|
: null);
|
|
116
|
-
var dataLabelsArray = (
|
|
123
|
+
var dataLabelsArray = (_x = props.dataLabelsArray) !== null && _x !== void 0 ? _x : polygonConfigArray === null || polygonConfigArray === void 0 ? void 0 : polygonConfigArray.map(function (polygonItem, index) {
|
|
117
124
|
return polygonItem.showDataValuesAsLabels ? data.map(function (d) { return d.toString(); }) : null;
|
|
118
125
|
});
|
|
119
|
-
var dataLabelsConfigArray = (
|
|
126
|
+
var dataLabelsConfigArray = (_z = (_y = props.dataLabelsConfigArray) === null || _y === void 0 ? void 0 : _y.map(function (dataLabelsConfigItem) {
|
|
120
127
|
var _a, _b, _c, _d, _e, _f;
|
|
121
128
|
return ({
|
|
122
129
|
fontSize: (_a = dataLabelsConfigItem.fontSize) !== null && _a !== void 0 ? _a : dataLabelsFontSize,
|
|
@@ -126,7 +133,7 @@ export var useRadarChart = function (props) {
|
|
|
126
133
|
fontWeight: (_e = dataLabelsConfigItem.fontWeight) !== null && _e !== void 0 ? _e : dataLabelsFontWeight,
|
|
127
134
|
fontFamily: (_f = dataLabelsConfigItem.fontFamily) !== null && _f !== void 0 ? _f : dataLabelsFontFamily
|
|
128
135
|
});
|
|
129
|
-
})) !== null &&
|
|
136
|
+
})) !== null && _z !== void 0 ? _z : Array(data.length).fill({
|
|
130
137
|
fontSize: dataLabelsFontSize,
|
|
131
138
|
stroke: dataLabelsColor,
|
|
132
139
|
textAnchor: dataLabelsTextAnchor,
|
|
@@ -134,7 +141,7 @@ export var useRadarChart = function (props) {
|
|
|
134
141
|
fontWeight: dataLabelsFontWeight,
|
|
135
142
|
fontFamily: dataLabelsFontFamily
|
|
136
143
|
});
|
|
137
|
-
var dataLabelsConfigSet = (
|
|
144
|
+
var dataLabelsConfigSet = (_1 = (_0 = props.dataLabelsConfigSet) === null || _0 === void 0 ? void 0 : _0.map(function (dataLabelConfigSetItem) {
|
|
138
145
|
return dataLabelConfigSetItem.map(function (dataLabelConfigItem) {
|
|
139
146
|
var _a, _b, _c, _d, _e, _f;
|
|
140
147
|
return ({
|
|
@@ -146,8 +153,8 @@ export var useRadarChart = function (props) {
|
|
|
146
153
|
fontFamily: (_f = dataLabelConfigItem.fontFamily) !== null && _f !== void 0 ? _f : dataLabelsFontFamily
|
|
147
154
|
});
|
|
148
155
|
});
|
|
149
|
-
})) !== null &&
|
|
150
|
-
var
|
|
156
|
+
})) !== null && _1 !== void 0 ? _1 : (dataSet ? Array(dataSet.length).fill(dataLabelsConfigArray) : null);
|
|
157
|
+
var _53 = asterLinesConfig.stroke, asterLinesStroke = _53 === void 0 ? gridStroke : _53, _54 = asterLinesConfig.strokeWidth, asterLinesStrokeWidth = _54 === void 0 ? gridStrokeWidth : _54, _55 = asterLinesConfig.strokeDashArray, asterLinesStrokeDashArray = _55 === void 0 ? radarChartDefaults.asterLineStrokeDashArray : _55;
|
|
151
158
|
// Calculate angles for each category
|
|
152
159
|
var angleStep = (360 / labels.length) * (isClockWise ? -1 : 1);
|
|
153
160
|
// Generate coordinates for the data points
|
|
@@ -159,18 +166,18 @@ export var useRadarChart = function (props) {
|
|
|
159
166
|
var angle = index * angleStep + startAngle;
|
|
160
167
|
return polarToCartesian(angle, 0);
|
|
161
168
|
});
|
|
162
|
-
var pointsArray = (
|
|
169
|
+
var pointsArray = (_2 = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) {
|
|
163
170
|
return set.map(function (value, index) {
|
|
164
171
|
var angle = index * angleStep + startAngle;
|
|
165
172
|
return polarToCartesian(angle, value);
|
|
166
173
|
});
|
|
167
|
-
})) !== null &&
|
|
168
|
-
var initialPointsArray = (
|
|
174
|
+
})) !== null && _2 !== void 0 ? _2 : [];
|
|
175
|
+
var initialPointsArray = (_3 = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) {
|
|
169
176
|
return set.map(function (value, index) {
|
|
170
177
|
var angle = index * angleStep + startAngle;
|
|
171
178
|
return polarToCartesian(angle, 0);
|
|
172
179
|
});
|
|
173
|
-
})) !== null &&
|
|
180
|
+
})) !== null && _3 !== void 0 ? _3 : [];
|
|
174
181
|
// Generate the polygon points for the radar chart (in SVG "x,y" format)
|
|
175
182
|
var polygonPoints = points.map(function (point) { return "".concat(point.x, ",").concat(point.y); }).join(' ');
|
|
176
183
|
var initialPolygonPoints = initialPoints
|
|
@@ -221,6 +228,7 @@ export var useRadarChart = function (props) {
|
|
|
221
228
|
center: center,
|
|
222
229
|
radius: radius,
|
|
223
230
|
chartSize: chartSize,
|
|
231
|
+
chartContainerProps: chartContainerProps,
|
|
224
232
|
noOfSections: noOfSections,
|
|
225
233
|
polarToCartesian: polarToCartesian,
|
|
226
234
|
labels: labels,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RadarChartContainerProps } from '../utils/types';
|
|
1
2
|
export interface GridConfig extends StrokeFillAndGradient {
|
|
2
3
|
gridSections?: GridSectionConfig[];
|
|
3
4
|
}
|
|
@@ -17,6 +18,7 @@ export interface RadarChartProps {
|
|
|
17
18
|
maxValue?: number;
|
|
18
19
|
noOfSections?: number;
|
|
19
20
|
chartSize?: number;
|
|
21
|
+
chartContainerProps?: RadarChartContainerProps;
|
|
20
22
|
labelConfig?: LabelConfig;
|
|
21
23
|
labelConfigArray?: LabelConfig[];
|
|
22
24
|
labels?: string[];
|
|
@@ -38,63 +38,63 @@ import { useEffect, useState } from 'react';
|
|
|
38
38
|
import { AxesAndRulesDefaults, BarDefaults, chartTypes } from '../../utils/constants';
|
|
39
39
|
import { computeMaxAndMinItems } from '../../utils';
|
|
40
40
|
export var useBarAndLineChartsWrapper = function (props) {
|
|
41
|
-
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;
|
|
41
|
+
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;
|
|
42
42
|
var chartType = props.chartType, containerHeight = props.containerHeight, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, sectionColors = props.sectionColors, stepHeight = props.stepHeight, negativeStepHeight = props.negativeStepHeight, labelsExtraHeight = props.labelsExtraHeight, yAxisLabelWidth = props.yAxisLabelWidth, horizontal = props.horizontal, rtl = props.rtl, shiftX = props.shiftX, shiftY = props.shiftY, initialSpacing = props.initialSpacing, data = props.data, dataSet = props.dataSet, stackData = props.stackData, secondaryData = props.secondaryData, barWidth = props.barWidth, xAxisThickness = props.xAxisThickness, totalWidth = props.totalWidth, spacing = props.spacing, lineConfig = props.lineConfig, lineConfig2 = props.lineConfig2, maxValue = props.maxValue, lineData = props.lineData, lineData2 = props.lineData2, animatedWidth = props.animatedWidth, lineBehindBars = props.lineBehindBars, points = props.points, points2 = props.points2, arrowPoints = props.arrowPoints, width = props.width, horizSections = props.horizSections, endSpacing = props.endSpacing, horizontalRulesStyle = props.horizontalRulesStyle, noOfSections = props.noOfSections, showFractionalValues = props.showFractionalValues, axesAndRulesProps = props.axesAndRulesProps, yAxisLabelTexts = props.yAxisLabelTexts, yAxisOffset = props.yAxisOffset, rotateYAxisTexts = props.rotateYAxisTexts, pointerConfig = props.pointerConfig, getPointerProps = props.getPointerProps, pointerIndex = props.pointerIndex, pointerX = props.pointerX, pointerY = props.pointerY, scrollEventThrottle = props.scrollEventThrottle, endReachedOffset = props.endReachedOffset, isRTL = props.isRTL, selectedIndex = props.selectedIndex, onlyPositive = props.onlyPositive, highlightEnabled = props.highlightEnabled, lowlightOpacity = props.lowlightOpacity, xAxisLabelsAtBottom = props.xAxisLabelsAtBottom, floatingYAxisLabels = props.floatingYAxisLabels, allowFontScaling = props.allowFontScaling;
|
|
43
|
-
var
|
|
43
|
+
var _22 = (_a = axesAndRulesProps.secondaryYAxisConfig) !== null && _a !== void 0 ? _a : {}, secondaryStepValue = _22.stepValue, secondaryNegativeStepValue = _22.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _22.noOfSectionsBelowXAxis, showSecondaryFractionalValues = _22.showFractionalValues, secondaryRoundToDigits = _22.roundToDigits, secondaryStepHeight = _22.stepHeight, secondaryNegativeStepHeight = _22.negativeStepHeight;
|
|
44
44
|
var primaryYAxisHeightBelowOrigin = noOfSectionsBelowXAxis * negativeStepHeight;
|
|
45
45
|
var secondaryYAxisHeightBelowOrigin = secondaryNoOfSectionsBelowXAxis * secondaryNegativeStepHeight;
|
|
46
46
|
var biggerNegativeYAxisHeight = Math.max(primaryYAxisHeightBelowOrigin, secondaryYAxisHeightBelowOrigin);
|
|
47
47
|
var yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop;
|
|
48
|
-
var hideOrigin = (
|
|
49
|
-
var yAxisSide = (
|
|
48
|
+
var hideOrigin = (_b = axesAndRulesProps.hideOrigin) !== null && _b !== void 0 ? _b : AxesAndRulesDefaults.hideOrigin;
|
|
49
|
+
var yAxisSide = (_c = axesAndRulesProps.yAxisSide) !== null && _c !== void 0 ? _c : AxesAndRulesDefaults.yAxisSide;
|
|
50
50
|
var yAxisLabelContainerStyle = axesAndRulesProps.yAxisLabelContainerStyle;
|
|
51
|
-
var yAxisColor = (
|
|
52
|
-
var yAxisExtraHeight = (
|
|
53
|
-
var trimYAxisAtTop = (
|
|
51
|
+
var yAxisColor = (_d = axesAndRulesProps.yAxisColor) !== null && _d !== void 0 ? _d : AxesAndRulesDefaults.yAxisColor;
|
|
52
|
+
var yAxisExtraHeight = (_e = axesAndRulesProps.yAxisExtraHeight) !== null && _e !== void 0 ? _e : containerHeight / 20;
|
|
53
|
+
var trimYAxisAtTop = (_f = axesAndRulesProps.trimYAxisAtTop) !== null && _f !== void 0 ? _f : AxesAndRulesDefaults.trimYAxisAtTop;
|
|
54
54
|
var overflowTop = axesAndRulesProps.overflowTop;
|
|
55
|
-
var yAxisThickness = (
|
|
56
|
-
var xAxisColor = (
|
|
55
|
+
var yAxisThickness = (_g = axesAndRulesProps.yAxisThickness) !== null && _g !== void 0 ? _g : AxesAndRulesDefaults.yAxisThickness;
|
|
56
|
+
var xAxisColor = (_h = axesAndRulesProps.xAxisColor) !== null && _h !== void 0 ? _h : AxesAndRulesDefaults.xAxisColor;
|
|
57
57
|
var xAxisLength = axesAndRulesProps.xAxisLength;
|
|
58
|
-
var xAxisType = (
|
|
59
|
-
var xAxisLabelsVerticalShift = (
|
|
58
|
+
var xAxisType = (_j = axesAndRulesProps.xAxisType) !== null && _j !== void 0 ? _j : AxesAndRulesDefaults.xAxisType;
|
|
59
|
+
var xAxisLabelsVerticalShift = (_k = axesAndRulesProps.xAxisLabelsVerticalShift) !== null && _k !== void 0 ? _k : (chartType === chartTypes.LINE && xAxisLabelsAtBottom
|
|
60
60
|
? biggerNegativeYAxisHeight
|
|
61
61
|
: AxesAndRulesDefaults.xAxisLabelsVerticalShift);
|
|
62
62
|
var xAxisLabelsHeight = axesAndRulesProps.xAxisLabelsHeight;
|
|
63
63
|
var xAxisTextNumberOfLines = axesAndRulesProps.xAxisTextNumberOfLines;
|
|
64
|
-
var dashWidth = (
|
|
65
|
-
var dashGap = (
|
|
66
|
-
var backgroundColor = (
|
|
67
|
-
var hideRules = (
|
|
64
|
+
var dashWidth = (_l = axesAndRulesProps.dashWidth) !== null && _l !== void 0 ? _l : AxesAndRulesDefaults.dashWidth;
|
|
65
|
+
var dashGap = (_m = axesAndRulesProps.dashGap) !== null && _m !== void 0 ? _m : AxesAndRulesDefaults.dashGap;
|
|
66
|
+
var backgroundColor = (_o = axesAndRulesProps.backgroundColor) !== null && _o !== void 0 ? _o : AxesAndRulesDefaults.backgroundColor;
|
|
67
|
+
var hideRules = (_p = axesAndRulesProps.hideRules) !== null && _p !== void 0 ? _p : AxesAndRulesDefaults.hideRules;
|
|
68
68
|
var rulesLength = axesAndRulesProps.rulesLength;
|
|
69
|
-
var rulesType = (
|
|
70
|
-
var rulesThickness = (
|
|
71
|
-
var rulesColor = (
|
|
72
|
-
var rulesConfigArray = (
|
|
73
|
-
var showYAxisIndices = (
|
|
74
|
-
var yAxisIndicesHeight = (
|
|
75
|
-
var yAxisIndicesWidth = (
|
|
76
|
-
var yAxisIndicesColor = (
|
|
77
|
-
var hideYAxisText = (
|
|
78
|
-
var yAxisTextNumberOfLines = (
|
|
79
|
-
var yAxisLabelPrefix = (
|
|
80
|
-
var yAxisLabelSuffix = (
|
|
69
|
+
var rulesType = (_q = axesAndRulesProps.rulesType) !== null && _q !== void 0 ? _q : AxesAndRulesDefaults.rulesType;
|
|
70
|
+
var rulesThickness = (_r = axesAndRulesProps.rulesThickness) !== null && _r !== void 0 ? _r : AxesAndRulesDefaults.rulesThickness;
|
|
71
|
+
var rulesColor = (_s = axesAndRulesProps.rulesColor) !== null && _s !== void 0 ? _s : AxesAndRulesDefaults.rulesColor;
|
|
72
|
+
var rulesConfigArray = (_t = axesAndRulesProps.rulesConfigArray) !== null && _t !== void 0 ? _t : AxesAndRulesDefaults.rulesConfigArray;
|
|
73
|
+
var showYAxisIndices = (_u = axesAndRulesProps.showYAxisIndices) !== null && _u !== void 0 ? _u : false;
|
|
74
|
+
var yAxisIndicesHeight = (_v = axesAndRulesProps.yAxisIndicesHeight) !== null && _v !== void 0 ? _v : AxesAndRulesDefaults.yAxisIndicesHeight;
|
|
75
|
+
var yAxisIndicesWidth = (_w = axesAndRulesProps.yAxisIndicesWidth) !== null && _w !== void 0 ? _w : AxesAndRulesDefaults.yAxisIndicesWidth;
|
|
76
|
+
var yAxisIndicesColor = (_x = axesAndRulesProps.yAxisIndicesColor) !== null && _x !== void 0 ? _x : AxesAndRulesDefaults.yAxisIndicesColor;
|
|
77
|
+
var hideYAxisText = (_y = axesAndRulesProps.hideYAxisText) !== null && _y !== void 0 ? _y : AxesAndRulesDefaults.hideYAxisText;
|
|
78
|
+
var yAxisTextNumberOfLines = (_z = axesAndRulesProps.yAxisTextNumberOfLines) !== null && _z !== void 0 ? _z : AxesAndRulesDefaults.yAxisTextNumberOfLines;
|
|
79
|
+
var yAxisLabelPrefix = (_0 = axesAndRulesProps.yAxisLabelPrefix) !== null && _0 !== void 0 ? _0 : '';
|
|
80
|
+
var yAxisLabelSuffix = (_1 = axesAndRulesProps.yAxisLabelSuffix) !== null && _1 !== void 0 ? _1 : '';
|
|
81
81
|
var yAxisTextStyle = axesAndRulesProps.yAxisTextStyle;
|
|
82
82
|
var secondaryYAxis = axesAndRulesProps.secondaryYAxis;
|
|
83
83
|
var stepValue = axesAndRulesProps.stepValue;
|
|
84
84
|
var negativeStepValue = axesAndRulesProps.negativeStepValue;
|
|
85
85
|
var roundToDigits = axesAndRulesProps.roundToDigits;
|
|
86
|
-
var referenceLinesConfig = axesAndRulesProps.referenceLinesConfig;
|
|
87
|
-
var referenceLinesOverChartContent = (
|
|
88
|
-
var showVerticalLines = (
|
|
89
|
-
var verticalLinesThickness = (
|
|
86
|
+
var referenceLinesConfig = (_2 = axesAndRulesProps.referenceLinesConfig) !== null && _2 !== void 0 ? _2 : {};
|
|
87
|
+
var referenceLinesOverChartContent = (_3 = referenceLinesConfig.referenceLinesOverChartContent) !== null && _3 !== void 0 ? _3 : AxesAndRulesDefaults.referenceLinesOverChartContent;
|
|
88
|
+
var showVerticalLines = (_4 = axesAndRulesProps.showVerticalLines) !== null && _4 !== void 0 ? _4 : AxesAndRulesDefaults.showVerticalLines;
|
|
89
|
+
var verticalLinesThickness = (_5 = axesAndRulesProps.verticalLinesThickness) !== null && _5 !== void 0 ? _5 : AxesAndRulesDefaults.verticalLinesThickness;
|
|
90
90
|
var verticalLinesHeight = axesAndRulesProps.verticalLinesHeight;
|
|
91
|
-
var verticalLinesColor = (
|
|
92
|
-
var verticalLinesStrokeDashArray = (
|
|
93
|
-
var verticalLinesShift = (
|
|
94
|
-
var verticalLinesZIndex = (
|
|
95
|
-
var verticalLinesSpacing = (
|
|
96
|
-
var verticalLinesUptoDataPoint = (
|
|
97
|
-
var verticalLinesStrokeLinecap = (
|
|
91
|
+
var verticalLinesColor = (_6 = axesAndRulesProps.verticalLinesColor) !== null && _6 !== void 0 ? _6 : AxesAndRulesDefaults.verticalLinesColor;
|
|
92
|
+
var verticalLinesStrokeDashArray = (_7 = axesAndRulesProps.verticalLinesStrokeDashArray) !== null && _7 !== void 0 ? _7 : AxesAndRulesDefaults.verticalLinesStrokeDashArray;
|
|
93
|
+
var verticalLinesShift = (_8 = axesAndRulesProps.verticalLinesShift) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.verticalLinesShift;
|
|
94
|
+
var verticalLinesZIndex = (_9 = axesAndRulesProps.verticalLinesZIndex) !== null && _9 !== void 0 ? _9 : AxesAndRulesDefaults.verticalLinesZIndex;
|
|
95
|
+
var verticalLinesSpacing = (_10 = axesAndRulesProps.verticalLinesSpacing) !== null && _10 !== void 0 ? _10 : AxesAndRulesDefaults.verticalLinesSpacing;
|
|
96
|
+
var verticalLinesUptoDataPoint = (_11 = axesAndRulesProps.verticalLinesUptoDataPoint) !== null && _11 !== void 0 ? _11 : AxesAndRulesDefaults.verticalLinesUptoDataPoint;
|
|
97
|
+
var verticalLinesStrokeLinecap = (_12 = axesAndRulesProps.verticalLinesStrokeLinecap) !== null && _12 !== void 0 ? _12 : AxesAndRulesDefaults.verticalLinesStrokeLinecap;
|
|
98
98
|
var noOfVerticalLines = axesAndRulesProps.noOfVerticalLines;
|
|
99
99
|
var secondaryXAxis = axesAndRulesProps.secondaryXAxis;
|
|
100
100
|
var verticalLinesAr = noOfVerticalLines
|
|
@@ -114,8 +114,8 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
114
114
|
});
|
|
115
115
|
var extendedContainerHeight = containerHeight + overflowTop + 10;
|
|
116
116
|
var dataSetArray = __spreadArray([], __read((dataSet !== null && dataSet !== void 0 ? dataSet : [])), false);
|
|
117
|
-
var setWithMinValueInDataset = (
|
|
118
|
-
.filter(function (set) { return set.isSecondary; })).sort) === null ||
|
|
117
|
+
var setWithMinValueInDataset = (_14 = (_13 = dataSetArray
|
|
118
|
+
.filter(function (set) { return set.isSecondary; })).sort) === null || _14 === void 0 ? void 0 : _14.call(_13, function (a, b) {
|
|
119
119
|
var minA = Math.min.apply(Math, __spreadArray([], __read(a.data.map(function (item) { return item.value; })), false));
|
|
120
120
|
var minB = Math.min.apply(Math, __spreadArray([], __read(b.data.map(function (item) { return item.value; })), false));
|
|
121
121
|
return minA - minB;
|
|
@@ -123,7 +123,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
123
123
|
var secondaryDataArrayWithMinValue = (secondaryData === null || secondaryData === void 0 ? void 0 : secondaryData.length)
|
|
124
124
|
? secondaryData
|
|
125
125
|
: setWithMinValueInDataset === null || setWithMinValueInDataset === void 0 ? void 0 : setWithMinValueInDataset.data;
|
|
126
|
-
var
|
|
126
|
+
var _23 = computeMaxAndMinItems(secondaryDataArrayWithMinValue, true, (_15 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.roundToDigits) !== null && _15 !== void 0 ? _15 : roundToDigits, (_16 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.showFractionalValues) !== null && _16 !== void 0 ? _16 : showFractionalValues), secondaryMaxItem = _23.maxItem, secondaryMinItem = _23.minItem;
|
|
127
127
|
var containerHeightIncludingBelowXAxis = extendedContainerHeight + biggerNegativeYAxisHeight;
|
|
128
128
|
var horizSectionProps = {
|
|
129
129
|
chartType: chartType,
|
|
@@ -207,7 +207,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
207
207
|
containerHeightIncludingBelowXAxis: containerHeightIncludingBelowXAxis,
|
|
208
208
|
lineConfig: lineConfig,
|
|
209
209
|
maxValue: (lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.isSecondary)
|
|
210
|
-
? (
|
|
210
|
+
? (_17 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue) !== null && _17 !== void 0 ? _17 : maxValue
|
|
211
211
|
: maxValue,
|
|
212
212
|
animatedWidth: animatedWidth,
|
|
213
213
|
lineBehindBars: lineBehindBars,
|
|
@@ -221,20 +221,20 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
221
221
|
xAxisLabelsVerticalShift: xAxisLabelsVerticalShift,
|
|
222
222
|
selectedIndex: selectedIndex,
|
|
223
223
|
yAxisOffset: (lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.isSecondary)
|
|
224
|
-
? (
|
|
224
|
+
? (_18 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisOffset) !== null && _18 !== void 0 ? _18 : 0
|
|
225
225
|
: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0,
|
|
226
|
-
strokeDashArray: (
|
|
226
|
+
strokeDashArray: (_19 = lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.strokeDashArray) !== null && _19 !== void 0 ? _19 : [0, 0],
|
|
227
227
|
highlightEnabled: highlightEnabled,
|
|
228
228
|
lowlightOpacity: lowlightOpacity
|
|
229
229
|
};
|
|
230
230
|
var lineInBarChartProps2 = __assign(__assign({}, lineInBarChartProps), { lineConfig: lineConfig2, points: points2, data: lineData2 !== null && lineData2 !== void 0 ? lineData2 : [], yAxisOffset: (lineConfig2 === null || lineConfig2 === void 0 ? void 0 : lineConfig2.isSecondary)
|
|
231
|
-
? (
|
|
231
|
+
? (_20 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisOffset) !== null && _20 !== void 0 ? _20 : 0
|
|
232
232
|
: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0 });
|
|
233
233
|
var verticalLinesProps = {
|
|
234
234
|
showVerticalLines: props.showVerticalLines,
|
|
235
235
|
verticalLinesAr: verticalLinesAr,
|
|
236
236
|
verticalLinesSpacing: verticalLinesSpacing,
|
|
237
|
-
spacing: (
|
|
237
|
+
spacing: (_21 = lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.spacing) !== null && _21 !== void 0 ? _21 : spacing,
|
|
238
238
|
initialSpacing: initialSpacing,
|
|
239
239
|
verticalLinesZIndex: verticalLinesZIndex,
|
|
240
240
|
verticalLinesHeight: verticalLinesHeight,
|
|
@@ -289,7 +289,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
289
289
|
: difBwWidthHeight - 40) /
|
|
290
290
|
2 +
|
|
291
291
|
(yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52), ")");
|
|
292
|
-
var
|
|
292
|
+
var _24 = __read(useState(false), 2), canMomentum = _24[0], setCanMomentum = _24[1];
|
|
293
293
|
var isCloseToEnd = function (_a) {
|
|
294
294
|
var layoutMeasurement = _a.layoutMeasurement, contentOffset = _a.contentOffset, contentSize = _a.contentSize;
|
|
295
295
|
return isRTL
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export { type stackDataItem, type StackedBarChartPropsType, type StackedBarChart
|
|
|
12
12
|
export { useLineChart } from './LineChart';
|
|
13
13
|
export { useLineChartBiColor } from './LineChart/LineChartBiColor';
|
|
14
14
|
export { type LineChartPropsType, type LineChartPropsTypeForWeb, type lineDataItem, type lineDataItemNullSafe, type bicolorLineDataItem, type LineChartBicolorPropsType, type LineChartBicolorPropsTypeForWeb } from './LineChart/types';
|
|
15
|
+
/************************************************************************************************************************
|
|
16
|
+
/***************************************** Bubble Chart *****************************************
|
|
17
|
+
/************************************************************************************************************************/
|
|
18
|
+
export { useBubbleChart } from './BubbleChart';
|
|
19
|
+
export { type BubbleChartPropsType, type bubbleDataItem } from './BubbleChart/types';
|
|
15
20
|
/***********************************************************************************************************************
|
|
16
21
|
/***************************************** Pie Chart *****************************************
|
|
17
22
|
/***********************************************************************************************************************/
|