gifted-charts-core 0.1.72 → 0.1.75

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.
@@ -0,0 +1,265 @@
1
+ import { ColorValue, GestureResponderEvent, StyleProp, TextStyle, ViewStyle } from 'react-native';
2
+ import { Linecap } from 'react-native-svg';
3
+ import { CustomBackground, RegressionLineConfig, 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
+ yNoOfSections?: number;
14
+ ySectionColors?: ColorValue[];
15
+ maxY?: number;
16
+ mostNegativeY?: number;
17
+ yStepHeight?: number;
18
+ yStepValue?: number;
19
+ yNegativeStepValue?: number;
20
+ showFractionalYAxis?: boolean;
21
+ yRoundToDigits?: number;
22
+ xNoOfSections?: number;
23
+ maxX?: number;
24
+ mostNegativeX?: number;
25
+ xStepHeight?: number;
26
+ xStepValue?: number;
27
+ showFractionalXAxis?: boolean;
28
+ xRoundToDigits?: number;
29
+ spacing?: number;
30
+ initialSpacing?: number;
31
+ endSpacing?: number;
32
+ data?: bubbleDataItem[];
33
+ zIndex?: number;
34
+ thickness?: number;
35
+ strokeDashArray?: number[];
36
+ strokeLinecap?: Linecap;
37
+ rotateLabel?: boolean;
38
+ isAnimated?: boolean;
39
+ animateOnDataChange?: boolean;
40
+ animationDuration?: number;
41
+ onDataChangeAnimationDuration?: number;
42
+ animationEasing?: any;
43
+ animateTogether?: boolean;
44
+ renderBubblesAfterAnimationEnds?: boolean;
45
+ xAxisLength?: number;
46
+ xAxisThickness?: number;
47
+ xAxisColor?: ColorValue;
48
+ xAxisType?: RuleType;
49
+ hideRules?: boolean;
50
+ rulesLength?: number;
51
+ rulesColor?: ColorValue;
52
+ rulesThickness?: number;
53
+ focusEnabled?: boolean;
54
+ onFocus?: Function;
55
+ showBubbleOnFocus?: boolean;
56
+ showStripOnFocus?: boolean;
57
+ stripOverBubbles?: boolean;
58
+ showTextOnFocus?: boolean;
59
+ showBubbleLabelOnFocus?: boolean;
60
+ stripHeight?: number;
61
+ stripWidth?: number;
62
+ stripColor?: ColorValue | string | any;
63
+ stripOpacity?: number;
64
+ stripStrokeDashArray?: number[];
65
+ onPress?: Function;
66
+ unFocusOnPressOut?: boolean;
67
+ delayBeforeUnFocus?: number;
68
+ focusedBubbleIndex?: number;
69
+ showValuesAsBubbleLabels?: boolean;
70
+ rulesType?: RuleType;
71
+ dashWidth?: number;
72
+ dashGap?: number;
73
+ rulesConfigArray?: RulesConfig[];
74
+ showReferenceLine1?: boolean;
75
+ referenceLine1Config?: referenceConfigType;
76
+ referenceLine1Position?: number;
77
+ showReferenceLine2?: boolean;
78
+ referenceLine2Config?: referenceConfigType;
79
+ referenceLine2Position?: number;
80
+ showReferenceLine3?: boolean;
81
+ referenceLine3Config?: referenceConfigType;
82
+ referenceLine3Position?: number;
83
+ referenceLinesOverChartContent?: boolean;
84
+ showVerticalLines?: boolean;
85
+ verticalLinesUptoDataPoint?: boolean;
86
+ verticalLinesThickness?: number;
87
+ verticalLinesHeight?: number;
88
+ verticalLinesColor?: ColorValue;
89
+ verticalLinesStrokeDashArray?: number[];
90
+ verticalLinesShift?: number;
91
+ verticalLinesZIndex?: number;
92
+ noOfVerticalLines?: number;
93
+ verticalLinesSpacing?: number;
94
+ verticalLinesStrokeLinecap?: Linecap;
95
+ hideAxesAndRules?: boolean;
96
+ areaChart?: boolean;
97
+ disableScroll?: boolean;
98
+ showScrollIndicator?: boolean;
99
+ indicatorColor?: 'black' | 'default' | 'white';
100
+ nestedScrollEnabled?: boolean;
101
+ showYAxisIndices?: boolean;
102
+ showXAxisIndices?: boolean;
103
+ yAxisIndicesHeight?: number;
104
+ xAxisIndicesHeight?: number;
105
+ yAxisIndicesWidth?: number;
106
+ xAxisIndicesWidth?: number;
107
+ xAxisIndicesColor?: ColorValue;
108
+ yAxisIndicesColor?: ColorValue;
109
+ yAxisSide?: yAxisSides;
110
+ yAxisOffset?: number;
111
+ yAxisThickness?: number;
112
+ yAxisColor?: ColorValue;
113
+ yAxisExtraHeight?: number;
114
+ trimYAxisAtTop?: boolean;
115
+ yAxisLabelContainerStyle?: StyleProp<ViewStyle>;
116
+ horizontalRulesStyle?: any;
117
+ yAxisTextStyle?: StyleProp<TextStyle>;
118
+ yAxisTextNumberOfLines?: number;
119
+ xAxisTextNumberOfLines?: number;
120
+ yAxisLabelWidth?: number;
121
+ hideYAxisText?: boolean;
122
+ floatingYAxisLabels?: boolean;
123
+ allowFontScaling?: boolean;
124
+ backgroundColor?: ColorValue;
125
+ customBackground?: CustomBackground;
126
+ horizSections?: sectionType[];
127
+ focusTogether?: boolean;
128
+ focusProximity?: number;
129
+ hideBubbles?: boolean;
130
+ bubblesHeight?: number;
131
+ bubblesWidth?: number;
132
+ bubblesRadius?: number;
133
+ bubblesColor?: string;
134
+ bubblesShape?: string;
135
+ customBubble?: Function;
136
+ focusedBubbleShape?: string;
137
+ focusedBubbleWidth?: number;
138
+ focusedBubbleHeight?: number;
139
+ focusedBubbleColor?: ColorValue | string | any;
140
+ focusedBubbleRadius?: number;
141
+ focusedCustomBubble?: Function;
142
+ gradientDirection?: string;
143
+ areaGradientComponent?: () => any;
144
+ areaGradientId?: string;
145
+ hideOrigin?: boolean;
146
+ yAxisLabelTexts?: string[];
147
+ xAxisLabelTexts?: string[];
148
+ xAxisLabelTextStyle?: StyleProp<TextStyle>;
149
+ xAxisLabelsHeight?: number;
150
+ xAxisLabelsVerticalShift?: number;
151
+ xAxisLabelsAtBottom?: boolean;
152
+ width?: number;
153
+ yAxisLabelPrefix?: string;
154
+ yAxisLabelSuffix?: string;
155
+ scrollRef?: any;
156
+ scrollToEnd?: boolean;
157
+ scrollToIndex?: number;
158
+ scrollAnimation?: boolean;
159
+ scrollEventThrottle?: number;
160
+ noOfSectionsBelowXAxis?: number;
161
+ labelsExtraHeight?: number;
162
+ adjustToWidth?: boolean;
163
+ getPointerProps?: Function;
164
+ formatYLabel?: (label: string) => string;
165
+ formatXLabel?: (label: string) => string;
166
+ lineGradient?: boolean;
167
+ lineGradientComponent?: () => any;
168
+ lineGradientId?: string;
169
+ lineGradientDirection?: string;
170
+ lineGradientStartColor?: string;
171
+ lineGradientEndColor?: string;
172
+ onEndReached?: () => void;
173
+ onStartReached?: () => void;
174
+ endReachedOffset?: number;
175
+ onScroll?: Function;
176
+ onMomentumScrollEnd?: Function;
177
+ bounces?: boolean;
178
+ overScrollMode?: 'auto' | 'always' | 'never';
179
+ onScrollEndDrag?: (event: any, direction: any) => void;
180
+ showBubblesForMissingValues?: boolean;
181
+ interpolateMissingValues?: boolean;
182
+ extrapolateMissingValues?: boolean;
183
+ onlyPositive?: boolean;
184
+ parentWidth?: number;
185
+ onChartAreaPress?: (event: GestureResponderEvent) => void;
186
+ onBackgroundPress?: (event: GestureResponderEvent) => void;
187
+ secondaryXAxis?: XAxisConfig;
188
+ renderTooltip?: Function;
189
+ renderTooltipSecondary?: Function;
190
+ labelWidth?: number;
191
+ labelHeight?: number;
192
+ labelFontSize?: number;
193
+ labelShiftX?: number;
194
+ labelShiftY?: number;
195
+ labelComponent?: Function;
196
+ labelTextStyle?: Object;
197
+ focusedLabelComponent?: Function;
198
+ spreadAreaData?: SpreadData[];
199
+ spreadAreaColor?: ColorValue;
200
+ spreadAreaOpacity?: number;
201
+ borderWidth?: number;
202
+ borderColor?: ColorValue;
203
+ borderOpacity?: number;
204
+ showRegressionLine?: boolean;
205
+ regressionLineConfig?: RegressionLineConfig;
206
+ }
207
+ export interface bubbleDataItem {
208
+ y: number;
209
+ label?: string;
210
+ labelWidth?: number;
211
+ labelHeight?: number;
212
+ labelFontSize?: number;
213
+ labelComponent?: Function;
214
+ labelTextStyle?: Object;
215
+ labelShiftX?: number;
216
+ labelShiftY?: number;
217
+ secondaryLabel?: string;
218
+ secondaryLabelComponent?: Function;
219
+ secondaryLabelTextStyle?: StyleProp<TextStyle>;
220
+ spacing?: number;
221
+ hideBubble?: boolean;
222
+ bubbleHeight?: number;
223
+ bubbleWidth?: number;
224
+ r?: number;
225
+ bubbleColor?: string;
226
+ bubbleShape?: string;
227
+ customBubble?: Function;
228
+ stripHeight?: number;
229
+ stripWidth?: number;
230
+ stripColor?: ColorValue | string | any;
231
+ stripOpacity?: number;
232
+ stripStrokeDashArray?: number[];
233
+ focusedBubbleShape?: string;
234
+ focusedBubbleWidth?: number;
235
+ focusedBubbleHeight?: number;
236
+ focusedBubbleColor?: ColorValue | string | any;
237
+ focusedBubbleRadius?: number;
238
+ focusedCustomBubble?: Function;
239
+ focusedLabelComponent?: Function;
240
+ showStrip?: boolean;
241
+ showVerticalLine?: boolean;
242
+ verticalLineHeight?: number;
243
+ verticalLineUptoBubble?: boolean;
244
+ verticalLineColor?: ColorValue;
245
+ verticalLineThickness?: number;
246
+ verticalLineStrokeDashArray?: number[];
247
+ verticalLineShift?: number;
248
+ verticalLineZIndex?: number;
249
+ verticalLineSpacing?: number;
250
+ verticalLineStrokeLinecap?: Linecap;
251
+ pointerShiftX?: number;
252
+ pointerShiftY?: number;
253
+ onPress?: Function;
254
+ onContextMenu?: Function;
255
+ onMouseEnter?: Function;
256
+ onMouseLeave?: Function;
257
+ showXAxisIndex?: boolean;
258
+ hidePointer?: boolean;
259
+ x?: number;
260
+ borderWidth?: number;
261
+ borderColor?: ColorValue;
262
+ borderOpacity?: number;
263
+ opacity?: number;
264
+ }
265
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -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;
@@ -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 _u = props.circular, circular = _u === void 0 ? false : _u, _v = props.gridConfig, gridConfig = _v === void 0 ? {} : _v, _w = props.polygonConfig, polygonConfig = _w === void 0 ? {} : _w, _x = props.data, data = _x === void 0 ? [] : _x, dataSet = props.dataSet, _y = props.noOfSections, noOfSections = _y === void 0 ? radarChartDefaults.noOfSections : _y, _z = props.chartSize, chartSize = _z === void 0 ? radarChartDefaults.chartSize : _z, _0 = props.labelConfig, labelConfig = _0 === void 0 ? {} : _0, labelConfigArray = props.labelConfigArray, _1 = props.asterLinesConfig, asterLinesConfig = _1 === void 0 ? {} : _1, _2 = props.hideGrid, hideGrid = _2 === void 0 ? radarChartDefaults.hideGrid : _2, _3 = props.hideLabels, hideLabels = _3 === void 0 ? radarChartDefaults.hideLabels : _3, _4 = props.hideAsterLines, hideAsterLines = _4 === void 0 ? (_a = props.hideGrid) !== null && _a !== void 0 ? _a : radarChartDefaults.hideAsterLines : _4, _5 = props.dataLabelsConfig, dataLabelsConfig = _5 === void 0 ? {} : _5, _6 = props.labelsPositionOffset, labelsPositionOffset = _6 === void 0 ? radarChartDefaults.labelsPositionOffset : _6, _7 = props.dataLabelsPositionOffset, dataLabelsPositionOffset = _7 === void 0 ? radarChartDefaults.dataLabelsPositionOffset : _7, _8 = props.isAnimated, isAnimated = _8 === void 0 ? radarChartDefaults.isAnimated : _8, _9 = props.animationDuration, animationDuration = _9 === void 0 ? radarChartDefaults.animationDuration : _9, _10 = props.animateTogether, animateTogether = _10 === void 0 ? radarChartDefaults.animateTogether : _10, _11 = props.startAngle, startAngle = _11 === void 0 ? radarChartDefaults.startAngle : _11, _12 = props.isClockWise, isClockWise = _12 === void 0 ? radarChartDefaults.isClockWise : _12;
41
- var labels = (_e = (_b = props.labels) !== null && _b !== void 0 ? _b : (_d = ((_c = dataSet === null || dataSet === void 0 ? void 0 : dataSet[0]) !== null && _c !== void 0 ? _c : data)) === null || _d === void 0 ? void 0 : _d.map(function (_, index) { return "Label".concat(index + 1); })) !== null && _e !== void 0 ? _e : [];
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 = (_f = props.maxValue) !== null && _f !== void 0 ? _f : (dataSet ? Math.max(getMax(dataSet !== null && dataSet !== void 0 ? dataSet : [])) : Math.max.apply(Math, __spreadArray([], __read((data !== null && data !== void 0 ? data : [])), false)));
49
- var dataLabels = (_g = props.dataLabels) !== null && _g !== void 0 ? _g : (polygonConfig.showDataValuesAsLabels
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 _13 = gridConfig.stroke, gridStroke = _13 === void 0 ? radarChartDefaults.gridSection.stroke : _13, _14 = gridConfig.strokeWidth, gridStrokeWidth = _14 === void 0 ? radarChartDefaults.gridSection.strokeWidth : _14, _15 = gridConfig.strokeDashArray, gridStrokeDashArray = _15 === void 0 ? radarChartDefaults.gridSection
62
- .strokeDashArray : _15, _16 = gridConfig.fill, gridFill = _16 === void 0 ? radarChartDefaults.gridSection.fill : _16, _17 = gridConfig.gradientColor, gridGradientColor = _17 === void 0 ? radarChartDefaults.gridSection
63
- .gradientColor : _17, _18 = gridConfig.showGradient, gridShowGradient = _18 === void 0 ? radarChartDefaults.gridSection
64
- .showGradient : _18, _19 = gridConfig.opacity, gridOpacity = _19 === void 0 ? radarChartDefaults.gridSection.opacity : _19, _20 = gridConfig.gradientOpacity, gridGradientOpacity = _20 === void 0 ? radarChartDefaults.gridSection
65
- .gradientOpacity : _20;
66
- var gridSections = (_j = (_h = gridConfig.gridSections) === null || _h === void 0 ? void 0 : _h.map(function (i) { return (__assign(__assign({}, radarChartDefaults.gridSection), i)); })) !== null && _j !== void 0 ? _j : Array(noOfSections).fill({});
67
- var _21 = labelConfig.fontSize, fontSize = _21 === void 0 ? radarChartDefaults.labelConfig.fontSize : _21, _22 = labelConfig.stroke, stroke = _22 === void 0 ? radarChartDefaults.labelConfig.stroke : _22, _23 = labelConfig.textAnchor, textAnchor = _23 === void 0 ? radarChartDefaults.labelConfig.textAnchor : _23, _24 = labelConfig.alignmentBaseline, alignmentBaseline = _24 === void 0 ? radarChartDefaults.labelConfig.alignmentBaseline : _24, _25 = labelConfig.fontWeight, fontWeight = _25 === void 0 ? radarChartDefaults.labelConfig.fontWeight : _25, _26 = labelConfig.fontFamily, fontFamily = _26 === void 0 ? radarChartDefaults.labelConfig.fontFamily : _26;
68
- var _27 = dataLabelsConfig.fontSize, dataLabelsFontSize = _27 === void 0 ? fontSize : _27, // defaults to labelConfig (from above)
69
- _28 = dataLabelsConfig.stroke, // defaults to labelConfig (from above)
70
- dataLabelsColor = _28 === void 0 ? stroke : _28, // defaults to labelConfig (from above)
71
- _29 = dataLabelsConfig.textAnchor, // defaults to labelConfig (from above)
72
- dataLabelsTextAnchor = _29 === void 0 ? textAnchor : _29, // defaults to labelConfig (from above)
73
- _30 = dataLabelsConfig.alignmentBaseline, // defaults to labelConfig (from above)
74
- dataLabelsAlignmentBaseline = _30 === void 0 ? alignmentBaseline : _30, // defaults to labelConfig (from above)
75
- _31 = dataLabelsConfig.fontWeight, // defaults to labelConfig (from above)
76
- dataLabelsFontWeight = _31 === void 0 ? fontWeight : _31, // defaults to labelConfig (from above)
77
- _32 = dataLabelsConfig.fontFamily // defaults to labelConfig (from above)
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 = _32 === void 0 ? fontFamily : _32 // defaults to labelConfig (from above)
86
+ dataLabelsFontFamily = _42 === void 0 ? fontFamily : _42 // defaults to labelConfig (from above)
80
87
  ;
81
- var _33 = polygonConfig.stroke, polygonStroke = _33 === void 0 ? radarChartDefaults.polygonConfig.stroke : _33, _34 = polygonConfig.strokeWidth, polygonStrokeWidth = _34 === void 0 ? radarChartDefaults.polygonConfig
82
- .strokeWidth : _34, _35 = polygonConfig.strokeDashArray, polygonStrokeDashArray = _35 === void 0 ? radarChartDefaults.polygonConfig
83
- .strokeDashArray : _35, _36 = polygonConfig.fill, polygonFill = _36 === void 0 ? radarChartDefaults.polygonConfig.fill : _36, _37 = polygonConfig.gradientColor, polygonGradientColor = _37 === void 0 ? radarChartDefaults.polygonConfig
84
- .gradientColor : _37, _38 = polygonConfig.showGradient, polygonShowGradient = _38 === void 0 ? radarChartDefaults.polygonConfig
85
- .showGradient : _38, _39 = polygonConfig.opacity, polygonOpacity = _39 === void 0 ? radarChartDefaults.polygonConfig.opacity : _39, _40 = polygonConfig.gradientOpacity, polygonGradientOpacity = _40 === void 0 ? polygonOpacity : _40, showDataValuesAsLabels = polygonConfig.showDataValuesAsLabels, _41 = polygonConfig.isAnimated, polygonIsAnimated = _41 === void 0 ? isAnimated : _41, _42 = polygonConfig.animationDuration, polygonAnimationDuration = _42 === void 0 ? animationDuration : _42;
86
- var polygonConfigArray = (_l = (_k = props.polygonConfigArray) === null || _k === void 0 ? void 0 : _k.map(function (set) {
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 && _l !== void 0 ? _l : (dataSet
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 = (_m = props.dataLabelsArray) !== null && _m !== void 0 ? _m : polygonConfigArray === null || polygonConfigArray === void 0 ? void 0 : polygonConfigArray.map(function (polygonItem, index) {
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 = (_p = (_o = props.dataLabelsConfigArray) === null || _o === void 0 ? void 0 : _o.map(function (dataLabelsConfigItem) {
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 && _p !== void 0 ? _p : Array(data.length).fill({
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 = (_r = (_q = props.dataLabelsConfigSet) === null || _q === void 0 ? void 0 : _q.map(function (dataLabelConfigSetItem) {
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 && _r !== void 0 ? _r : (dataSet ? Array(dataSet.length).fill(dataLabelsConfigArray) : null);
150
- var _43 = asterLinesConfig.stroke, asterLinesStroke = _43 === void 0 ? gridStroke : _43, _44 = asterLinesConfig.strokeWidth, asterLinesStrokeWidth = _44 === void 0 ? gridStrokeWidth : _44, _45 = asterLinesConfig.strokeDashArray, asterLinesStrokeDashArray = _45 === void 0 ? radarChartDefaults.asterLineStrokeDashArray : _45;
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 = (_s = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) {
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 && _s !== void 0 ? _s : [];
168
- var initialPointsArray = (_t = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) {
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 && _t !== void 0 ? _t : [];
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[];