gifted-charts-core 0.1.72 → 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/types.d.ts +1 -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.js +2 -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 +13 -0
- package/dist/utils/index.js +12 -8
- package/dist/utils/types.d.ts +7 -0
- package/package.json +1 -1
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;
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
26
|
+
import { useState } from 'react';
|
|
27
|
+
import { computeMaxAndMinItems, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getMaxValue, getNoOfSections, indexOfFirstNonZeroDigit } from '../utils';
|
|
28
|
+
import { AxesAndRulesDefaults, BubbleDefaults, chartTypes, LineDefaults } from '../utils/constants';
|
|
29
|
+
export var useBubbleChart = function (props) {
|
|
30
|
+
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;
|
|
31
|
+
var _37 = props.data, data = _37 === void 0 ? [] : _37;
|
|
32
|
+
var noOfSections = getNoOfSections(props.noOfSections, props.maxValue, props.stepValue);
|
|
33
|
+
var containerHeight = (_a = props.height) !== null && _a !== void 0 ? _a : (((_b = props.stepHeight) !== null && _b !== void 0 ? _b : 0) * noOfSections ||
|
|
34
|
+
AxesAndRulesDefaults.containerHeight);
|
|
35
|
+
var valuesRange = Math.max.apply(Math, __spreadArray([], __read(data.map(function (i) { return Math.max(i.value, 0); })), false)) - // find the largest +ve number
|
|
36
|
+
Math.min.apply(// find the largest +ve number
|
|
37
|
+
Math, __spreadArray([], __read(data.map(function (i) { return Math.max(i.value, 0); })), false)); // find the smallest +ve number
|
|
38
|
+
var showFractionalValues = (_c = props.showFractionalValues) !== null && _c !== void 0 ? _c : (isFinite(valuesRange) && valuesRange <= 1);
|
|
39
|
+
var roundToDigits = (_d = props.roundToDigits) !== null && _d !== void 0 ? _d : (showFractionalValues ? indexOfFirstNonZeroDigit(valuesRange) + 1 : 0);
|
|
40
|
+
var _38 = computeMaxAndMinItems(data, false, // extrapolateMissingValues
|
|
41
|
+
roundToDigits, showFractionalValues, data), maxItem = _38.maxItem, minItem = _38.minItem;
|
|
42
|
+
var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxItem) || 10;
|
|
43
|
+
var mostNegativeValue = (_e = props.mostNegativeValue) !== null && _e !== void 0 ? _e : minItem;
|
|
44
|
+
var onlyPositive = (_f = props.onlyPositive) !== null && _f !== void 0 ? _f : mostNegativeValue >= 0;
|
|
45
|
+
var horizSections = [{ value: '0' }];
|
|
46
|
+
var stepHeight = (_g = props.stepHeight) !== null && _g !== void 0 ? _g : containerHeight / noOfSections;
|
|
47
|
+
var stepValue = (_h = props.stepValue) !== null && _h !== void 0 ? _h : maxValue / noOfSections;
|
|
48
|
+
var noOfSectionsBelowXAxis = (_j = props.noOfSectionsBelowXAxis) !== null && _j !== void 0 ? _j : Math.round(Math.ceil(-mostNegativeValue / stepValue));
|
|
49
|
+
var labelsExtraHeight = (_k = props.labelsExtraHeight) !== null && _k !== void 0 ? _k : 0;
|
|
50
|
+
var yAxisLabelWidth = (_l = props.yAxisLabelWidth) !== null && _l !== void 0 ? _l : (props.hideYAxisText
|
|
51
|
+
? AxesAndRulesDefaults.yAxisEmptyLabelWidth
|
|
52
|
+
: AxesAndRulesDefaults.yAxisLabelWidth);
|
|
53
|
+
var horizontal = false;
|
|
54
|
+
var yAxisAtTop = false;
|
|
55
|
+
var initialSpacing = (_m = props.initialSpacing) !== null && _m !== void 0 ? _m : LineDefaults.initialSpacing;
|
|
56
|
+
var xAxisThickness = (_o = props.xAxisThickness) !== null && _o !== void 0 ? _o : AxesAndRulesDefaults.xAxisThickness;
|
|
57
|
+
var spacing = (_p = props.spacing) !== null && _p !== void 0 ? _p : LineDefaults.spacing;
|
|
58
|
+
var cumulativeSpacing = [];
|
|
59
|
+
var spacingSum = 0;
|
|
60
|
+
var space = (_q = props.spacing) !== null && _q !== void 0 ? _q : spacing;
|
|
61
|
+
data.forEach(function (item) {
|
|
62
|
+
var _a;
|
|
63
|
+
spacingSum += (_a = item.spacing) !== null && _a !== void 0 ? _a : space;
|
|
64
|
+
cumulativeSpacing.push(spacingSum);
|
|
65
|
+
});
|
|
66
|
+
var totalWidth = initialSpacing +
|
|
67
|
+
spacing * (data.length - 1) +
|
|
68
|
+
((_r = props.endSpacing) !== null && _r !== void 0 ? _r : LineDefaults.endSpacing);
|
|
69
|
+
var endSpacing = (_s = props.endSpacing) !== null && _s !== void 0 ? _s : LineDefaults.endSpacing;
|
|
70
|
+
var disableScroll = (_t = props.disableScroll) !== null && _t !== void 0 ? _t : false;
|
|
71
|
+
var showScrollIndicator = (_u = props.showScrollIndicator) !== null && _u !== void 0 ? _u : false;
|
|
72
|
+
var scrollToEnd = (_v = props.scrollToEnd) !== null && _v !== void 0 ? _v : false;
|
|
73
|
+
var scrollAnimation = (_w = props.scrollAnimation) !== null && _w !== void 0 ? _w : false;
|
|
74
|
+
var scrollEventThrottle = (_x = props.scrollEventThrottle) !== null && _x !== void 0 ? _x : 16;
|
|
75
|
+
var focusEnabled = (_y = props.focusEnabled) !== null && _y !== void 0 ? _y : LineDefaults.focusEnabled;
|
|
76
|
+
var showDataPointOnFocus = (_z = props.showDataPointOnFocus) !== null && _z !== void 0 ? _z : LineDefaults.showDataPointOnFocus;
|
|
77
|
+
var _39 = __read(useState((_0 = props.focusedDataPointIndex) !== null && _0 !== void 0 ? _0 : -1), 2), selectedIndex = _39[0], setSelectedIndex = _39[1];
|
|
78
|
+
var _40 = __read(useState(''), 2), points = _40[0], setPoints = _40[1];
|
|
79
|
+
var _41 = __read(useState(-1), 2), pointerIndex = _41[0], setPointerIndex = _41[1];
|
|
80
|
+
var _42 = __read(useState(0), 2), pointerX = _42[0], setPointerX = _42[1];
|
|
81
|
+
var _43 = __read(useState(0), 2), pointerY = _43[0], setPointerY = _43[1];
|
|
82
|
+
var isAnimated = (_1 = props.isAnimated) !== null && _1 !== void 0 ? _1 : false;
|
|
83
|
+
var horizontalRulesStyle = props.horizontalRulesStyle;
|
|
84
|
+
var yAxisOffset = (_2 = props.yAxisOffset) !== null && _2 !== void 0 ? _2 : 0;
|
|
85
|
+
var showXAxisIndices = (_3 = props.showXAxisIndices) !== null && _3 !== void 0 ? _3 : AxesAndRulesDefaults.showXAxisIndices;
|
|
86
|
+
var xAxisIndicesHeight = (_4 = props.xAxisIndicesHeight) !== null && _4 !== void 0 ? _4 : AxesAndRulesDefaults.xAxisIndicesHeight;
|
|
87
|
+
var xAxisIndicesWidth = (_5 = props.xAxisIndicesWidth) !== null && _5 !== void 0 ? _5 : AxesAndRulesDefaults.xAxisIndicesWidth;
|
|
88
|
+
var xAxisIndicesColor = (_6 = props.xAxisIndicesColor) !== null && _6 !== void 0 ? _6 : AxesAndRulesDefaults.xAxisIndicesColor;
|
|
89
|
+
// const pointerConfig = props.pointerConfig
|
|
90
|
+
var getPointerProps = (_7 = props.getPointerProps) !== null && _7 !== void 0 ? _7 : null;
|
|
91
|
+
var dataPointsRadius = (_8 = props.dataPointsRadius) !== null && _8 !== void 0 ? _8 : LineDefaults.dataPointsRadius;
|
|
92
|
+
var dataPointsWidth = (_9 = props.dataPointsWidth) !== null && _9 !== void 0 ? _9 : LineDefaults.dataPointsWidth;
|
|
93
|
+
var extraWidthDueToDataPoint = props.hideDataPoints
|
|
94
|
+
? 0
|
|
95
|
+
: dataPointsRadius !== null && dataPointsRadius !== void 0 ? dataPointsRadius : dataPointsWidth;
|
|
96
|
+
var xAxisLabelsAtBottom = (_10 = props.xAxisLabelsAtBottom) !== null && _10 !== void 0 ? _10 : false;
|
|
97
|
+
var allowFontScaling = (_11 = props.allowFontScaling) !== null && _11 !== void 0 ? _11 : AxesAndRulesDefaults.allowFontScaling;
|
|
98
|
+
var animationDuration = (_12 = props.animationDuration) !== null && _12 !== void 0 ? _12 : LineDefaults.animationDuration;
|
|
99
|
+
var negativeStepValue = (_13 = props.negativeStepValue) !== null && _13 !== void 0 ? _13 : stepValue;
|
|
100
|
+
var secondaryMaxValue = maxValue;
|
|
101
|
+
var secondaryMinItem = maxValue * -1;
|
|
102
|
+
var showSecondaryFractionalValues = false;
|
|
103
|
+
var secondaryRoundToDigits = 1;
|
|
104
|
+
var axesAndRulesProps = getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, roundToDigits, negativeStepValue, secondaryMaxValue, secondaryMinItem, showSecondaryFractionalValues, secondaryRoundToDigits);
|
|
105
|
+
var fourthQuadrantHeight = noOfSectionsBelowXAxis * stepHeight;
|
|
106
|
+
var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
|
|
107
|
+
var containerHeightIncludingBelowXAxis = extendedContainerHeight + fourthQuadrantHeight;
|
|
108
|
+
var mostNegativeValueOnYAxis = negativeStepValue * noOfSectionsBelowXAxis;
|
|
109
|
+
var containsNegativeValue = ((_14 = props.mostNegativeValue) !== null && _14 !== void 0 ? _14 : 0) < 0 ||
|
|
110
|
+
((_15 = props.data) === null || _15 === void 0 ? void 0 : _15.some(function (item) { var _a; return ((_a = item.y) !== null && _a !== void 0 ? _a : 0) < 0; }));
|
|
111
|
+
var getX = function (spacingArray, index) {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
return (_b = (_a = props.data) === null || _a === void 0 ? void 0 : _a[index].x) !== null && _b !== void 0 ? _b : initialSpacing + (index ? spacingArray[index - 1] : 0);
|
|
114
|
+
};
|
|
115
|
+
var getY = function (value) {
|
|
116
|
+
if (containsNegativeValue && value < 0 && stepValue !== negativeStepValue) {
|
|
117
|
+
return (extendedContainerHeight +
|
|
118
|
+
(value * fourthQuadrantHeight) / mostNegativeValueOnYAxis);
|
|
119
|
+
}
|
|
120
|
+
return extendedContainerHeight - (value * containerHeight) / maxValue;
|
|
121
|
+
};
|
|
122
|
+
var showTextOnFocus = (_16 = props.showTextOnFocus) !== null && _16 !== void 0 ? _16 : LineDefaults.showTextOnFocus;
|
|
123
|
+
var showDataPointLabelOnFocus = (_17 = props.showDataPointLabelOnFocus) !== null && _17 !== void 0 ? _17 : LineDefaults.showDataPointLabelOnFocus;
|
|
124
|
+
var focusTogether = (_18 = props.focusTogether) !== null && _18 !== void 0 ? _18 : true;
|
|
125
|
+
var _44 = __read(useState(-1), 2), selectedLineNumber = _44[0], setSelectedLineNumber = _44[1];
|
|
126
|
+
var lastLineNumber = 1;
|
|
127
|
+
// if (props.secondaryData) {
|
|
128
|
+
// lastLineNumber = 6667 // lastLineNumber is 6667 for a secondary line, so the index or key of the secondary line is 6666
|
|
129
|
+
// }
|
|
130
|
+
// if (props.data2) lastLineNumber = 2
|
|
131
|
+
// if (props.data3) lastLineNumber = 3
|
|
132
|
+
// if (props.data4) lastLineNumber = 4
|
|
133
|
+
// if (props.data5) lastLineNumber = 5
|
|
134
|
+
// if ((props.dataSet?.length ?? 0) > lastLineNumber)
|
|
135
|
+
// lastLineNumber = props.dataSet?.length ?? 0
|
|
136
|
+
var unFocusOnPressOut = (_19 = props.unFocusOnPressOut) !== null && _19 !== void 0 ? _19 : LineDefaults.unFocusOnPressOut;
|
|
137
|
+
var delayBeforeUnFocus = (_20 = props.delayBeforeUnFocus) !== null && _20 !== void 0 ? _20 : LineDefaults.delayBeforeUnFocus;
|
|
138
|
+
var handleFocus = function (index) {
|
|
139
|
+
setSelectedIndex(index);
|
|
140
|
+
};
|
|
141
|
+
var handleUnFocus = function () {
|
|
142
|
+
if (unFocusOnPressOut) {
|
|
143
|
+
setTimeout(function () { return setSelectedIndex(-1); }, delayBeforeUnFocus);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var hideDataPoints = (_21 = props.hideDataPoints) !== null && _21 !== void 0 ? _21 : false;
|
|
147
|
+
var dataPointsShape = (_22 = props.dataPointsShape) !== null && _22 !== void 0 ? _22 : LineDefaults.dataPointsShape;
|
|
148
|
+
var dataPointsHeight = (_23 = props.dataPointsHeight) !== null && _23 !== void 0 ? _23 : LineDefaults.dataPointsHeight;
|
|
149
|
+
var dataPointsColor = (_24 = props.dataPointsColor) !== null && _24 !== void 0 ? _24 : BubbleDefaults.dataPointsColor;
|
|
150
|
+
var textFontSize = (_25 = props.textFontSize) !== null && _25 !== void 0 ? _25 : LineDefaults.textFontSize;
|
|
151
|
+
var textColor = (_26 = props.textColor) !== null && _26 !== void 0 ? _26 : LineDefaults.textColor;
|
|
152
|
+
var startIndex = 0;
|
|
153
|
+
var endIndex = (_28 = (_27 = props.data) === null || _27 === void 0 ? void 0 : _27.length) !== null && _28 !== void 0 ? _28 : 0;
|
|
154
|
+
var showValuesAsDataPointsText = (_29 = props.showValuesAsDataPointsText) !== null && _29 !== void 0 ? _29 : LineDefaults.showValuesAsDataPointsText;
|
|
155
|
+
var xAxisLabelsVerticalShift = (_30 = props.xAxisLabelsVerticalShift) !== null && _30 !== void 0 ? _30 : (xAxisLabelsAtBottom
|
|
156
|
+
? fourthQuadrantHeight
|
|
157
|
+
: AxesAndRulesDefaults.xAxisLabelsVerticalShift);
|
|
158
|
+
var xAxisTextNumberOfLines = (_31 = props.xAxisTextNumberOfLines) !== null && _31 !== void 0 ? _31 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
|
|
159
|
+
var rotateLabel = (_32 = props.rotateLabel) !== null && _32 !== void 0 ? _32 : false;
|
|
160
|
+
var borderWidth = (_33 = props.borderWidth) !== null && _33 !== void 0 ? _33 : BubbleDefaults.borderWidth;
|
|
161
|
+
var borderColor = (_34 = props.borderColor) !== null && _34 !== void 0 ? _34 : BubbleDefaults.borderColor;
|
|
162
|
+
var opacity = (_35 = props.opacity) !== null && _35 !== void 0 ? _35 : BubbleDefaults.opacity;
|
|
163
|
+
var barAndLineChartsWrapperProps = {
|
|
164
|
+
chartType: chartTypes.BUBBLE,
|
|
165
|
+
containerHeight: containerHeight,
|
|
166
|
+
noOfSectionsBelowXAxis: noOfSectionsBelowXAxis,
|
|
167
|
+
stepHeight: stepHeight,
|
|
168
|
+
negativeStepHeight: stepHeight,
|
|
169
|
+
labelsExtraHeight: labelsExtraHeight,
|
|
170
|
+
yAxisLabelWidth: yAxisLabelWidth,
|
|
171
|
+
horizontal: horizontal,
|
|
172
|
+
rtl: false,
|
|
173
|
+
shiftX: 0,
|
|
174
|
+
shiftY: 0,
|
|
175
|
+
yAxisAtTop: yAxisAtTop,
|
|
176
|
+
initialSpacing: initialSpacing,
|
|
177
|
+
data: data,
|
|
178
|
+
stackData: undefined, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
179
|
+
secondaryData: undefined, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
180
|
+
barWidth: 0, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
181
|
+
xAxisThickness: xAxisThickness,
|
|
182
|
+
totalWidth: totalWidth,
|
|
183
|
+
disableScroll: disableScroll,
|
|
184
|
+
showScrollIndicator: showScrollIndicator,
|
|
185
|
+
scrollToEnd: scrollToEnd,
|
|
186
|
+
scrollToIndex: props.scrollToIndex,
|
|
187
|
+
scrollAnimation: scrollAnimation,
|
|
188
|
+
scrollEventThrottle: scrollEventThrottle,
|
|
189
|
+
indicatorColor: props.indicatorColor,
|
|
190
|
+
selectedIndex: [selectedIndex],
|
|
191
|
+
setSelectedIndex: setSelectedIndex,
|
|
192
|
+
spacing: spacing,
|
|
193
|
+
showLine: false,
|
|
194
|
+
lineConfig: null, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
195
|
+
lineConfig2: null, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
196
|
+
maxValue: maxValue,
|
|
197
|
+
lineData: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
198
|
+
lineData2: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
199
|
+
lineBehindBars: false,
|
|
200
|
+
points: points,
|
|
201
|
+
points2: '', // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
202
|
+
arrowPoints: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
|
|
203
|
+
// horizSectionProps-
|
|
204
|
+
width: props.width,
|
|
205
|
+
horizSections: horizSections,
|
|
206
|
+
endSpacing: endSpacing,
|
|
207
|
+
horizontalRulesStyle: horizontalRulesStyle,
|
|
208
|
+
noOfSections: noOfSections,
|
|
209
|
+
sectionColors: props.sectionColors,
|
|
210
|
+
showFractionalValues: showFractionalValues,
|
|
211
|
+
axesAndRulesProps: axesAndRulesProps,
|
|
212
|
+
yAxisLabelTexts: props.yAxisLabelTexts,
|
|
213
|
+
yAxisOffset: yAxisOffset,
|
|
214
|
+
rotateYAxisTexts: 0,
|
|
215
|
+
hideAxesAndRules: props.hideAxesAndRules,
|
|
216
|
+
showXAxisIndices: showXAxisIndices,
|
|
217
|
+
xAxisIndicesHeight: xAxisIndicesHeight,
|
|
218
|
+
xAxisIndicesWidth: xAxisIndicesWidth,
|
|
219
|
+
xAxisIndicesColor: xAxisIndicesColor,
|
|
220
|
+
getPointerProps: getPointerProps,
|
|
221
|
+
pointerIndex: pointerIndex,
|
|
222
|
+
pointerX: pointerX,
|
|
223
|
+
pointerY: pointerY,
|
|
224
|
+
onEndReached: props.onEndReached,
|
|
225
|
+
onStartReached: props.onStartReached,
|
|
226
|
+
endReachedOffset: (_36 = props.endReachedOffset) !== null && _36 !== void 0 ? _36 : LineDefaults.endReachedOffset,
|
|
227
|
+
onMomentumScrollEnd: props.onMomentumScrollEnd,
|
|
228
|
+
extraWidthDueToDataPoint: extraWidthDueToDataPoint,
|
|
229
|
+
customBackground: props.customBackground,
|
|
230
|
+
onlyPositive: onlyPositive,
|
|
231
|
+
highlightEnabled: LineDefaults.highlightEnabled,
|
|
232
|
+
lowlightOpacity: LineDefaults.lowlightOpacity,
|
|
233
|
+
xAxisLabelsAtBottom: xAxisLabelsAtBottom,
|
|
234
|
+
onScrollEndDrag: props.onScrollEndDrag,
|
|
235
|
+
allowFontScaling: allowFontScaling,
|
|
236
|
+
showVerticalLines: props.showVerticalLines
|
|
237
|
+
};
|
|
238
|
+
return {
|
|
239
|
+
totalWidth: totalWidth,
|
|
240
|
+
animationDuration: animationDuration,
|
|
241
|
+
containerHeightIncludingBelowXAxis: containerHeightIncludingBelowXAxis,
|
|
242
|
+
getY: getY,
|
|
243
|
+
barAndLineChartsWrapperProps: barAndLineChartsWrapperProps,
|
|
244
|
+
getX: getX,
|
|
245
|
+
maxValue: maxValue,
|
|
246
|
+
selectedIndex: selectedIndex,
|
|
247
|
+
setSelectedIndex: setSelectedIndex,
|
|
248
|
+
showTextOnFocus: showTextOnFocus,
|
|
249
|
+
focusEnabled: focusEnabled,
|
|
250
|
+
focusTogether: focusTogether,
|
|
251
|
+
selectedLineNumber: selectedLineNumber,
|
|
252
|
+
lastLineNumber: lastLineNumber,
|
|
253
|
+
initialSpacing: initialSpacing,
|
|
254
|
+
spacing: spacing,
|
|
255
|
+
containerHeight: containerHeight,
|
|
256
|
+
handleFocus: handleFocus,
|
|
257
|
+
handleUnFocus: handleUnFocus,
|
|
258
|
+
isAnimated: isAnimated,
|
|
259
|
+
showDataPointOnFocus: showDataPointOnFocus,
|
|
260
|
+
showDataPointLabelOnFocus: showDataPointLabelOnFocus,
|
|
261
|
+
dataPointsShape: dataPointsShape,
|
|
262
|
+
dataPointsWidth: dataPointsWidth,
|
|
263
|
+
dataPointsHeight: dataPointsHeight,
|
|
264
|
+
dataPointsColor: dataPointsColor,
|
|
265
|
+
dataPointsRadius: dataPointsRadius,
|
|
266
|
+
textColor: textColor,
|
|
267
|
+
textFontSize: textFontSize,
|
|
268
|
+
startIndex: startIndex,
|
|
269
|
+
endIndex: endIndex,
|
|
270
|
+
showValuesAsDataPointsText: showValuesAsDataPointsText,
|
|
271
|
+
cumulativeSpacing: cumulativeSpacing,
|
|
272
|
+
hideDataPoints: hideDataPoints,
|
|
273
|
+
xAxisLabelsVerticalShift: xAxisLabelsVerticalShift,
|
|
274
|
+
labelsExtraHeight: labelsExtraHeight,
|
|
275
|
+
xAxisThickness: xAxisThickness,
|
|
276
|
+
xAxisTextNumberOfLines: xAxisTextNumberOfLines,
|
|
277
|
+
rotateLabel: rotateLabel,
|
|
278
|
+
allowFontScaling: allowFontScaling,
|
|
279
|
+
borderWidth: borderWidth,
|
|
280
|
+
borderColor: borderColor,
|
|
281
|
+
opacity: opacity
|
|
282
|
+
};
|
|
283
|
+
};
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { ColorValue, GestureResponderEvent, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
import { Linecap } from "react-native-svg";
|
|
3
|
+
import { ColorFromToY, CustomBackground, RuleType, RulesConfig, SpreadData, XAxisConfig, referenceConfigType } from "../utils/types";
|
|
4
|
+
import { yAxisSides } from "../utils/constants";
|
|
5
|
+
interface sectionType {
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BubbleChartPropsType {
|
|
9
|
+
opacity?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
overflowTop?: number;
|
|
12
|
+
overflowBottom?: number;
|
|
13
|
+
noOfSections?: number;
|
|
14
|
+
sectionColors?: ColorValue[];
|
|
15
|
+
maxValue?: number;
|
|
16
|
+
mostNegativeValue?: number;
|
|
17
|
+
stepHeight?: number;
|
|
18
|
+
stepValue?: number;
|
|
19
|
+
negativeStepValue?: number;
|
|
20
|
+
spacing?: number;
|
|
21
|
+
initialSpacing?: number;
|
|
22
|
+
endSpacing?: number;
|
|
23
|
+
data?: bubbleDataItem[];
|
|
24
|
+
zIndex?: number;
|
|
25
|
+
thickness?: number;
|
|
26
|
+
strokeDashArray?: number[];
|
|
27
|
+
strokeLinecap?: Linecap;
|
|
28
|
+
rotateLabel?: boolean;
|
|
29
|
+
isAnimated?: boolean;
|
|
30
|
+
animateOnDataChange?: boolean;
|
|
31
|
+
animationDuration?: number;
|
|
32
|
+
onDataChangeAnimationDuration?: number;
|
|
33
|
+
animationEasing?: any;
|
|
34
|
+
animateTogether?: boolean;
|
|
35
|
+
renderDataPointsAfterAnimationEnds?: boolean;
|
|
36
|
+
xAxisLength?: number;
|
|
37
|
+
xAxisThickness?: number;
|
|
38
|
+
xAxisColor?: ColorValue;
|
|
39
|
+
xAxisType?: RuleType;
|
|
40
|
+
hideRules?: boolean;
|
|
41
|
+
rulesLength?: number;
|
|
42
|
+
rulesColor?: ColorValue;
|
|
43
|
+
rulesThickness?: number;
|
|
44
|
+
focusEnabled?: boolean;
|
|
45
|
+
onFocus?: Function;
|
|
46
|
+
showDataPointOnFocus?: boolean;
|
|
47
|
+
showStripOnFocus?: boolean;
|
|
48
|
+
stripOverDataPoints?: boolean;
|
|
49
|
+
showTextOnFocus?: boolean;
|
|
50
|
+
showDataPointLabelOnFocus?: boolean;
|
|
51
|
+
stripHeight?: number;
|
|
52
|
+
stripWidth?: number;
|
|
53
|
+
stripColor?: ColorValue | string | any;
|
|
54
|
+
stripOpacity?: number;
|
|
55
|
+
stripStrokeDashArray?: number[];
|
|
56
|
+
onPress?: Function;
|
|
57
|
+
unFocusOnPressOut?: boolean;
|
|
58
|
+
delayBeforeUnFocus?: number;
|
|
59
|
+
focusedDataPointIndex?: number;
|
|
60
|
+
showValuesAsDataPointsText?: boolean;
|
|
61
|
+
rulesType?: RuleType;
|
|
62
|
+
dashWidth?: number;
|
|
63
|
+
dashGap?: number;
|
|
64
|
+
rulesConfigArray?: RulesConfig[];
|
|
65
|
+
showReferenceLine1?: boolean;
|
|
66
|
+
referenceLine1Config?: referenceConfigType;
|
|
67
|
+
referenceLine1Position?: number;
|
|
68
|
+
showReferenceLine2?: boolean;
|
|
69
|
+
referenceLine2Config?: referenceConfigType;
|
|
70
|
+
referenceLine2Position?: number;
|
|
71
|
+
showReferenceLine3?: boolean;
|
|
72
|
+
referenceLine3Config?: referenceConfigType;
|
|
73
|
+
referenceLine3Position?: number;
|
|
74
|
+
referenceLinesOverChartContent?: boolean;
|
|
75
|
+
showVerticalLines?: boolean;
|
|
76
|
+
verticalLinesUptoDataPoint?: boolean;
|
|
77
|
+
verticalLinesThickness?: number;
|
|
78
|
+
verticalLinesHeight?: number;
|
|
79
|
+
verticalLinesColor?: ColorValue;
|
|
80
|
+
verticalLinesStrokeDashArray?: number[];
|
|
81
|
+
verticalLinesShift?: number;
|
|
82
|
+
verticalLinesZIndex?: number;
|
|
83
|
+
noOfVerticalLines?: number;
|
|
84
|
+
verticalLinesSpacing?: number;
|
|
85
|
+
verticalLinesStrokeLinecap?: Linecap;
|
|
86
|
+
hideAxesAndRules?: boolean;
|
|
87
|
+
areaChart?: boolean;
|
|
88
|
+
disableScroll?: boolean;
|
|
89
|
+
showScrollIndicator?: boolean;
|
|
90
|
+
indicatorColor?: 'black' | 'default' | 'white';
|
|
91
|
+
nestedScrollEnabled?: boolean;
|
|
92
|
+
showYAxisIndices?: boolean;
|
|
93
|
+
showXAxisIndices?: boolean;
|
|
94
|
+
yAxisIndicesHeight?: number;
|
|
95
|
+
xAxisIndicesHeight?: number;
|
|
96
|
+
yAxisIndicesWidth?: number;
|
|
97
|
+
xAxisIndicesWidth?: number;
|
|
98
|
+
xAxisIndicesColor?: ColorValue;
|
|
99
|
+
yAxisIndicesColor?: ColorValue;
|
|
100
|
+
yAxisSide?: yAxisSides;
|
|
101
|
+
yAxisOffset?: number;
|
|
102
|
+
startIndex?: number;
|
|
103
|
+
endIndex?: number;
|
|
104
|
+
color?: string;
|
|
105
|
+
colors?: ColorFromToY[];
|
|
106
|
+
yAxisThickness?: number;
|
|
107
|
+
yAxisColor?: ColorValue;
|
|
108
|
+
yAxisExtraHeight?: number;
|
|
109
|
+
trimYAxisAtTop?: boolean;
|
|
110
|
+
yAxisLabelContainerStyle?: StyleProp<ViewStyle>;
|
|
111
|
+
horizontalRulesStyle?: any;
|
|
112
|
+
yAxisTextStyle?: StyleProp<TextStyle>;
|
|
113
|
+
yAxisTextNumberOfLines?: number;
|
|
114
|
+
xAxisTextNumberOfLines?: number;
|
|
115
|
+
showFractionalValues?: boolean;
|
|
116
|
+
roundToDigits?: number;
|
|
117
|
+
yAxisLabelWidth?: number;
|
|
118
|
+
hideYAxisText?: boolean;
|
|
119
|
+
floatingYAxisLabels?: boolean;
|
|
120
|
+
allowFontScaling?: boolean;
|
|
121
|
+
backgroundColor?: ColorValue;
|
|
122
|
+
customBackground?: CustomBackground;
|
|
123
|
+
horizSections?: sectionType[];
|
|
124
|
+
focusTogether?: boolean;
|
|
125
|
+
focusProximity?: number;
|
|
126
|
+
hideDataPoints?: boolean;
|
|
127
|
+
dataPointsHeight?: number;
|
|
128
|
+
dataPointsWidth?: number;
|
|
129
|
+
dataPointsRadius?: number;
|
|
130
|
+
dataPointsColor?: string;
|
|
131
|
+
dataPointsShape?: string;
|
|
132
|
+
customDataPoint?: Function;
|
|
133
|
+
focusedDataPointShape?: string;
|
|
134
|
+
focusedDataPointWidth?: number;
|
|
135
|
+
focusedDataPointHeight?: number;
|
|
136
|
+
focusedDataPointColor?: ColorValue | string | any;
|
|
137
|
+
focusedDataPointRadius?: number;
|
|
138
|
+
focusedCustomDataPoint?: Function;
|
|
139
|
+
dataPointLabelWidth?: number;
|
|
140
|
+
dataPointLabelShiftX?: number;
|
|
141
|
+
dataPointLabelShiftY?: number;
|
|
142
|
+
startFillColor?: string;
|
|
143
|
+
endFillColor?: string;
|
|
144
|
+
startOpacity?: number;
|
|
145
|
+
endOpacity?: number;
|
|
146
|
+
gradientDirection?: string;
|
|
147
|
+
areaGradientComponent?: () => any;
|
|
148
|
+
areaGradientId?: string;
|
|
149
|
+
textFontSize?: number;
|
|
150
|
+
textColor?: string;
|
|
151
|
+
hideOrigin?: boolean;
|
|
152
|
+
textShiftX?: number;
|
|
153
|
+
textShiftY?: number;
|
|
154
|
+
yAxisLabelTexts?: string[];
|
|
155
|
+
xAxisLabelTexts?: string[];
|
|
156
|
+
xAxisLabelTextStyle?: StyleProp<TextStyle>;
|
|
157
|
+
xAxisLabelsHeight?: number;
|
|
158
|
+
xAxisLabelsVerticalShift?: number;
|
|
159
|
+
xAxisLabelsAtBottom?: boolean;
|
|
160
|
+
width?: number;
|
|
161
|
+
yAxisLabelPrefix?: string;
|
|
162
|
+
yAxisLabelSuffix?: string;
|
|
163
|
+
scrollRef?: any;
|
|
164
|
+
scrollToEnd?: boolean;
|
|
165
|
+
scrollToIndex?: number;
|
|
166
|
+
scrollAnimation?: boolean;
|
|
167
|
+
scrollEventThrottle?: number;
|
|
168
|
+
noOfSectionsBelowXAxis?: number;
|
|
169
|
+
labelsExtraHeight?: number;
|
|
170
|
+
adjustToWidth?: boolean;
|
|
171
|
+
getPointerProps?: Function;
|
|
172
|
+
formatYLabel?: (label: string) => string;
|
|
173
|
+
lineGradient?: boolean;
|
|
174
|
+
lineGradientComponent?: () => any;
|
|
175
|
+
lineGradientId?: string;
|
|
176
|
+
lineGradientDirection?: string;
|
|
177
|
+
lineGradientStartColor?: string;
|
|
178
|
+
lineGradientEndColor?: string;
|
|
179
|
+
onEndReached?: () => void;
|
|
180
|
+
onStartReached?: () => void;
|
|
181
|
+
endReachedOffset?: number;
|
|
182
|
+
onScroll?: Function;
|
|
183
|
+
onMomentumScrollEnd?: Function;
|
|
184
|
+
bounces?: boolean;
|
|
185
|
+
overScrollMode?: 'auto' | 'always' | 'never';
|
|
186
|
+
onScrollEndDrag?: (event: any, direction: any) => void;
|
|
187
|
+
showDataPointsForMissingValues?: boolean;
|
|
188
|
+
interpolateMissingValues?: boolean;
|
|
189
|
+
extrapolateMissingValues?: boolean;
|
|
190
|
+
onlyPositive?: boolean;
|
|
191
|
+
parentWidth?: number;
|
|
192
|
+
onChartAreaPress?: (event: GestureResponderEvent) => void;
|
|
193
|
+
onBackgroundPress?: (event: GestureResponderEvent) => void;
|
|
194
|
+
secondaryXAxis?: XAxisConfig;
|
|
195
|
+
renderTooltip?: Function;
|
|
196
|
+
renderTooltipSecondary?: Function;
|
|
197
|
+
dataPointLabelComponent?: Function;
|
|
198
|
+
focusedDataPointLabelComponent?: Function;
|
|
199
|
+
spreadAreaData?: SpreadData[];
|
|
200
|
+
spreadAreaColor?: ColorValue;
|
|
201
|
+
spreadAreaOpacity?: number;
|
|
202
|
+
borderWidth?: number;
|
|
203
|
+
borderColor?: ColorValue;
|
|
204
|
+
}
|
|
205
|
+
export interface bubbleDataItem {
|
|
206
|
+
y: number;
|
|
207
|
+
label?: string;
|
|
208
|
+
labelComponent?: Function;
|
|
209
|
+
labelTextStyle?: StyleProp<TextStyle>;
|
|
210
|
+
secondaryLabel?: string;
|
|
211
|
+
secondaryLabelComponent?: Function;
|
|
212
|
+
secondaryLabelTextStyle?: StyleProp<TextStyle>;
|
|
213
|
+
dataPointText?: string;
|
|
214
|
+
textShiftX?: number;
|
|
215
|
+
textShiftY?: number;
|
|
216
|
+
textColor?: string;
|
|
217
|
+
textFontSize?: number;
|
|
218
|
+
spacing?: number;
|
|
219
|
+
hideDataPoint?: boolean;
|
|
220
|
+
dataPointHeight?: number;
|
|
221
|
+
dataPointWidth?: number;
|
|
222
|
+
r?: number;
|
|
223
|
+
dataPointColor?: string;
|
|
224
|
+
dataPointShape?: string;
|
|
225
|
+
customDataPoint?: Function;
|
|
226
|
+
stripHeight?: number;
|
|
227
|
+
stripWidth?: number;
|
|
228
|
+
stripColor?: ColorValue | string | any;
|
|
229
|
+
stripOpacity?: number;
|
|
230
|
+
stripStrokeDashArray?: number[];
|
|
231
|
+
focusedDataPointShape?: string;
|
|
232
|
+
focusedDataPointWidth?: number;
|
|
233
|
+
focusedDataPointHeight?: number;
|
|
234
|
+
focusedDataPointColor?: ColorValue | string | any;
|
|
235
|
+
focusedDataPointRadius?: number;
|
|
236
|
+
focusedCustomDataPoint?: Function;
|
|
237
|
+
dataPointLabelComponent?: Function;
|
|
238
|
+
focusedDataPointLabelComponent?: Function;
|
|
239
|
+
dataPointLabelWidth?: number;
|
|
240
|
+
dataPointLabelShiftX?: number;
|
|
241
|
+
dataPointLabelShiftY?: number;
|
|
242
|
+
showStrip?: boolean;
|
|
243
|
+
showVerticalLine?: boolean;
|
|
244
|
+
verticalLineHeight?: number;
|
|
245
|
+
verticalLineUptoDataPoint?: boolean;
|
|
246
|
+
verticalLineColor?: ColorValue;
|
|
247
|
+
verticalLineThickness?: number;
|
|
248
|
+
verticalLineStrokeDashArray?: number[];
|
|
249
|
+
verticalLineShift?: number;
|
|
250
|
+
verticalLineZIndex?: number;
|
|
251
|
+
verticalLineSpacing?: number;
|
|
252
|
+
verticalLineStrokeLinecap?: Linecap;
|
|
253
|
+
pointerShiftX?: number;
|
|
254
|
+
pointerShiftY?: number;
|
|
255
|
+
onPress?: Function;
|
|
256
|
+
onContextMenu?: Function;
|
|
257
|
+
onMouseEnter?: Function;
|
|
258
|
+
onMouseLeave?: Function;
|
|
259
|
+
showXAxisIndex?: boolean;
|
|
260
|
+
hidePointer?: boolean;
|
|
261
|
+
x?: number;
|
|
262
|
+
borderWidth?: number;
|
|
263
|
+
borderColor?: ColorValue;
|
|
264
|
+
opacity?: number;
|
|
265
|
+
}
|
|
266
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/PieChart/index.js
CHANGED
|
@@ -65,11 +65,12 @@ export var usePieChart = function (props) {
|
|
|
65
65
|
}
|
|
66
66
|
}, [props.data, initialAngle, props.semiCircle]);
|
|
67
67
|
useEffect(function () {
|
|
68
|
+
var _a, _b;
|
|
68
69
|
if (selectedIndex !== -1) {
|
|
69
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));
|
|
@@ -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
|
/***********************************************************************************************************************/
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,10 @@ export { useRenderBars } from './BarChart/RenderBars';
|
|
|
10
10
|
/************************************************************************************************************************/
|
|
11
11
|
export { useLineChart } from './LineChart';
|
|
12
12
|
export { useLineChartBiColor } from './LineChart/LineChartBiColor';
|
|
13
|
+
/************************************************************************************************************************
|
|
14
|
+
/***************************************** Bubble Chart *****************************************
|
|
15
|
+
/************************************************************************************************************************/
|
|
16
|
+
export { useBubbleChart } from './BubbleChart';
|
|
13
17
|
/***********************************************************************************************************************
|
|
14
18
|
/***************************************** Pie Chart *****************************************
|
|
15
19
|
/***********************************************************************************************************************/
|
|
@@ -4,7 +4,8 @@ import { type FontStyle } from 'react-native-svg';
|
|
|
4
4
|
export declare enum chartTypes {
|
|
5
5
|
BAR = 0,
|
|
6
6
|
LINE = 1,
|
|
7
|
-
LINE_BI_COLOR = 2
|
|
7
|
+
LINE_BI_COLOR = 2,
|
|
8
|
+
BUBBLE = 3
|
|
8
9
|
}
|
|
9
10
|
export declare const defaultCurvature = 0.2;
|
|
10
11
|
export declare const defaultAnimationDuration = 800;
|
|
@@ -175,6 +176,12 @@ export declare const LineDefaults: {
|
|
|
175
176
|
highlightEnabled: boolean;
|
|
176
177
|
lowlightOpacity: number;
|
|
177
178
|
};
|
|
179
|
+
export declare const BubbleDefaults: {
|
|
180
|
+
borderWidth: number;
|
|
181
|
+
borderColor: string;
|
|
182
|
+
opacity: number;
|
|
183
|
+
dataPointsColor: string;
|
|
184
|
+
};
|
|
178
185
|
export declare const defaultLineConfig: defaultLineConfigType;
|
|
179
186
|
export declare const defaultPointerConfig: {
|
|
180
187
|
height: number;
|
|
@@ -309,6 +316,11 @@ export declare const radarChartDefaults: {
|
|
|
309
316
|
showGradient: boolean;
|
|
310
317
|
opacity: number;
|
|
311
318
|
};
|
|
319
|
+
chartContainerProps: {
|
|
320
|
+
shiftX: number;
|
|
321
|
+
shiftY: number;
|
|
322
|
+
backgroundColor: string;
|
|
323
|
+
};
|
|
312
324
|
asterLineStrokeDashArray: number[];
|
|
313
325
|
isAnimated: boolean;
|
|
314
326
|
animationDuration: number;
|
package/dist/utils/constants.js
CHANGED
|
@@ -5,6 +5,7 @@ export var chartTypes;
|
|
|
5
5
|
chartTypes[chartTypes["BAR"] = 0] = "BAR";
|
|
6
6
|
chartTypes[chartTypes["LINE"] = 1] = "LINE";
|
|
7
7
|
chartTypes[chartTypes["LINE_BI_COLOR"] = 2] = "LINE_BI_COLOR";
|
|
8
|
+
chartTypes[chartTypes["BUBBLE"] = 3] = "BUBBLE";
|
|
8
9
|
})(chartTypes || (chartTypes = {}));
|
|
9
10
|
export var defaultCurvature = 0.2;
|
|
10
11
|
var defaultCurveType = CurveType.CUBIC;
|
|
@@ -187,6 +188,13 @@ export var LineDefaults = {
|
|
|
187
188
|
highlightEnabled: false,
|
|
188
189
|
lowlightOpacity: 0.3
|
|
189
190
|
};
|
|
191
|
+
// Bubble chart specific
|
|
192
|
+
export var BubbleDefaults = {
|
|
193
|
+
borderWidth: 0,
|
|
194
|
+
borderColor: '#333',
|
|
195
|
+
opacity: 0.8,
|
|
196
|
+
dataPointsColor: 'skyblue'
|
|
197
|
+
};
|
|
190
198
|
export var defaultLineConfig = {
|
|
191
199
|
initialSpacing: BarDefaults.spacing, // gets updated to spacing before being used
|
|
192
200
|
curved: false,
|
|
@@ -364,6 +372,11 @@ export var radarChartDefaults = {
|
|
|
364
372
|
showGradient: false,
|
|
365
373
|
opacity: 0.7
|
|
366
374
|
},
|
|
375
|
+
chartContainerProps: {
|
|
376
|
+
shiftX: 0,
|
|
377
|
+
shiftY: 0,
|
|
378
|
+
backgroundColor: 'transparent'
|
|
379
|
+
},
|
|
367
380
|
asterLineStrokeDashArray: [4, 4],
|
|
368
381
|
isAnimated: false,
|
|
369
382
|
animationDuration: 800,
|
package/dist/utils/index.js
CHANGED
|
@@ -494,7 +494,7 @@ export var getArrowPoints = function (arrowTipX, arrowTipY, x1, y1, arrowLength,
|
|
|
494
494
|
return arrowPoints;
|
|
495
495
|
};
|
|
496
496
|
export var getAxesAndRulesProps = function (props, containerHeight, stepHeight, stepValue, noOfSections, roundToDigits, negativeStepValue, secondaryMaxValue, secondaryMinItem, showSecondaryFractionalValues, secondaryRoundToDigits) {
|
|
497
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
497
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
498
498
|
var secondaryYAxis = typeof props.secondaryYAxis === 'boolean' ? {} : props.secondaryYAxis;
|
|
499
499
|
var axesAndRulesProps = {
|
|
500
500
|
yAxisSide: props.yAxisSide,
|
|
@@ -576,15 +576,19 @@ export var getAxesAndRulesProps = function (props, containerHeight, stepHeight,
|
|
|
576
576
|
secondaryYAxis.maxValue === undefined) {
|
|
577
577
|
axesAndRulesProps.secondaryYAxis = __assign(__assign({}, secondaryYAxis), { maxValue: secondaryMaxValue });
|
|
578
578
|
}
|
|
579
|
-
var secondaryNoOfSections = (_j = secondaryYAxis
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
var
|
|
583
|
-
|
|
584
|
-
|
|
579
|
+
var secondaryNoOfSections = ((_j = props.secondaryYAxis) !== null && _j !== void 0 ? _j : (_k = props.lineConfig) === null || _k === void 0 ? void 0 : _k.isSecondary)
|
|
580
|
+
? (_l = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.noOfSections) !== null && _l !== void 0 ? _l : noOfSections
|
|
581
|
+
: 0;
|
|
582
|
+
var secondaryStepValue = (_m = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.stepValue) !== null && _m !== void 0 ? _m : (secondaryNoOfSections
|
|
583
|
+
? ((_o = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue) !== null && _o !== void 0 ? _o : secondaryMaxValue) / secondaryNoOfSections
|
|
584
|
+
: 0);
|
|
585
|
+
var secondaryStepHeight = (_p = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.stepHeight) !== null && _p !== void 0 ? _p : (secondaryNoOfSections ? containerHeight / secondaryNoOfSections : 0);
|
|
586
|
+
var secondaryNegativeStepValue = (_q = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.negativeStepValue) !== null && _q !== void 0 ? _q : secondaryStepValue;
|
|
587
|
+
var secondaryNoOfSectionsBelowXAxis = (_r = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.noOfSectionsBelowXAxis) !== null && _r !== void 0 ? _r : (secondaryNegativeStepValue
|
|
588
|
+
? Math.ceil(((_s = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.mostNegativeValue) !== null && _s !== void 0 ? _s : secondaryMinItem) /
|
|
585
589
|
-secondaryNegativeStepValue)
|
|
586
590
|
: 0);
|
|
587
|
-
axesAndRulesProps.secondaryYAxisConfig = __assign(__assign({}, secondaryYAxis), { stepHeight: secondaryStepHeight, stepValue: secondaryStepValue, negativeStepHeight: (
|
|
591
|
+
axesAndRulesProps.secondaryYAxisConfig = __assign(__assign({}, secondaryYAxis), { stepHeight: secondaryStepHeight, stepValue: secondaryStepValue, negativeStepHeight: (_t = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.negativeStepHeight) !== null && _t !== void 0 ? _t : secondaryStepHeight, negativeStepValue: secondaryNegativeStepValue, noOfSectionsBelowXAxis: secondaryNoOfSectionsBelowXAxis, showFractionalValues: showSecondaryFractionalValues, roundToDigits: secondaryRoundToDigits });
|
|
588
592
|
return axesAndRulesProps;
|
|
589
593
|
};
|
|
590
594
|
export var getExtendedContainerHeightWithPadding = function (containerHeight, overflowTop) { return containerHeight + (overflowTop !== null && overflowTop !== void 0 ? overflowTop : 0) + 10; };
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -508,4 +508,11 @@ export interface ColorFromToY {
|
|
|
508
508
|
to: number;
|
|
509
509
|
color: ColorValue;
|
|
510
510
|
}
|
|
511
|
+
export interface RadarChartContainerProps {
|
|
512
|
+
height?: number;
|
|
513
|
+
width?: number;
|
|
514
|
+
shiftX?: number;
|
|
515
|
+
shiftY?: number;
|
|
516
|
+
backgroundColor?: ColorValue;
|
|
517
|
+
}
|
|
511
518
|
export {};
|