victory-pie 36.9.2 → 37.0.0
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/CHANGELOG.md +6 -0
- package/dist/victory-pie.js +3531 -4664
- package/dist/victory-pie.min.js +1 -1
- package/es/helper-methods.js +189 -219
- package/es/slice.js +48 -54
- package/es/victory-pie.js +118 -192
- package/lib/helper-methods.js +191 -252
- package/lib/index.js +0 -4
- package/lib/slice.js +50 -77
- package/lib/victory-pie.js +118 -200
- package/package.json +3 -3
package/es/helper-methods.js
CHANGED
|
@@ -1,83 +1,78 @@
|
|
|
1
1
|
import _isPlainObject from "lodash/isPlainObject";
|
|
2
2
|
import _defaults from "lodash/defaults";
|
|
3
|
+
/* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1, 2, 45, 90, 135, 180, 225, 270, 315, 360] }]*/
|
|
3
4
|
import * as d3Shape from "victory-vendor/d3-shape";
|
|
4
5
|
import { Helpers, Data, Style } from "victory-core";
|
|
5
|
-
|
|
6
|
-
var checkForValidText = function (text) {
|
|
6
|
+
const checkForValidText = text => {
|
|
7
7
|
if (text === undefined || text === null || Helpers.isFunction(text)) {
|
|
8
8
|
return text;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
return "".concat(text);
|
|
10
|
+
return `${text}`;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
var getColor = function (style, colors, index) {
|
|
12
|
+
const getColor = (style, colors, index) => {
|
|
15
13
|
if (style && style.data && style.data.fill) {
|
|
16
14
|
return style.data.fill;
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
return colors && colors[index % colors.length];
|
|
20
17
|
};
|
|
21
|
-
|
|
22
|
-
var getRadius = function (props, padding) {
|
|
18
|
+
const getRadius = (props, padding) => {
|
|
23
19
|
if (typeof props.radius === "number") {
|
|
24
20
|
return props.radius;
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
return Math.min(props.width - padding.left - padding.right, props.height - padding.top - padding.bottom) / 2;
|
|
28
23
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
const getOrigin = (props, padding) => {
|
|
25
|
+
const {
|
|
26
|
+
width,
|
|
27
|
+
height
|
|
28
|
+
} = props;
|
|
29
|
+
const origin = _isPlainObject(props.origin) ? props.origin : {};
|
|
34
30
|
return {
|
|
35
31
|
x: origin.x !== undefined ? origin.x : (padding.left - padding.right + width) / 2,
|
|
36
32
|
y: origin.y !== undefined ? origin.y : (padding.top - padding.bottom + height) / 2
|
|
37
33
|
};
|
|
38
34
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var layoutFunction = d3Shape.pie().sort(null).startAngle(Helpers.degreesToRadians(props.startAngle)).endAngle(Helpers.degreesToRadians(props.endAngle)).padAngle(Helpers.degreesToRadians(padAngle)).value(function (datum) {
|
|
35
|
+
const getSlices = (props, data) => {
|
|
36
|
+
const padAngle = Helpers.isFunction(props.padAngle) ? 0 : props.padAngle;
|
|
37
|
+
const layoutFunction = d3Shape.pie().sort(null).startAngle(Helpers.degreesToRadians(props.startAngle)).endAngle(Helpers.degreesToRadians(props.endAngle)).padAngle(Helpers.degreesToRadians(padAngle)).value(datum => {
|
|
43
38
|
return datum._y;
|
|
44
39
|
});
|
|
45
40
|
return layoutFunction(data);
|
|
46
41
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
const getCalculatedValues = props => {
|
|
43
|
+
const {
|
|
44
|
+
colorScale
|
|
45
|
+
} = props;
|
|
46
|
+
const styleObject = Helpers.getDefaultStyles(props, "pie");
|
|
47
|
+
const style = Helpers.getStyles(props.style, styleObject);
|
|
48
|
+
const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale);
|
|
49
|
+
const padding = Helpers.getPadding(props);
|
|
50
|
+
const defaultRadius = getRadius(props, padding);
|
|
51
|
+
const origin = getOrigin(props, padding);
|
|
52
|
+
const data = Data.getData(props);
|
|
53
|
+
const slices = getSlices(props, data);
|
|
58
54
|
return Object.assign({}, props, {
|
|
59
|
-
style
|
|
60
|
-
colors
|
|
61
|
-
padding
|
|
62
|
-
defaultRadius
|
|
63
|
-
data
|
|
64
|
-
slices
|
|
65
|
-
origin
|
|
55
|
+
style,
|
|
56
|
+
colors,
|
|
57
|
+
padding,
|
|
58
|
+
defaultRadius,
|
|
59
|
+
data,
|
|
60
|
+
slices,
|
|
61
|
+
origin
|
|
66
62
|
});
|
|
67
63
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
const getSliceStyle = (index, calculatedValues) => {
|
|
65
|
+
const {
|
|
66
|
+
style,
|
|
67
|
+
colors
|
|
68
|
+
} = calculatedValues;
|
|
69
|
+
const fill = getColor(style, colors, index);
|
|
73
70
|
return Object.assign({
|
|
74
|
-
fill
|
|
71
|
+
fill
|
|
75
72
|
}, style.data);
|
|
76
73
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var text;
|
|
80
|
-
|
|
74
|
+
const getLabelText = (props, datum, index) => {
|
|
75
|
+
let text;
|
|
81
76
|
if (datum.label) {
|
|
82
77
|
text = datum.label;
|
|
83
78
|
} else if (Array.isArray(props.labels)) {
|
|
@@ -85,35 +80,29 @@ var getLabelText = function (props, datum, index) {
|
|
|
85
80
|
} else {
|
|
86
81
|
text = Helpers.isFunction(props.labels) ? props.labels : datum.xName || datum._x;
|
|
87
82
|
}
|
|
88
|
-
|
|
89
83
|
return checkForValidText(text);
|
|
90
84
|
};
|
|
91
|
-
|
|
92
|
-
var getLabelArc = function (labelRadius) {
|
|
85
|
+
const getLabelArc = labelRadius => {
|
|
93
86
|
return d3Shape.arc().outerRadius(labelRadius).innerRadius(labelRadius);
|
|
94
87
|
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var padding = style && style.padding || 0;
|
|
88
|
+
const getCalculatedLabelRadius = (radius, labelRadius, style) => {
|
|
89
|
+
const padding = style && style.padding || 0;
|
|
98
90
|
return labelRadius || radius + padding;
|
|
99
91
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var construct = {
|
|
92
|
+
const getLabelPosition = (arc, slice, position) => {
|
|
93
|
+
const construct = {
|
|
103
94
|
startAngle: position === "startAngle" ? slice.startAngle : slice.endAngle,
|
|
104
95
|
endAngle: position === "endAngle" ? slice.endAngle : slice.startAngle
|
|
105
96
|
};
|
|
106
|
-
|
|
97
|
+
const clonedArc = Object.assign({}, slice, construct);
|
|
107
98
|
return arc.centroid(clonedArc);
|
|
108
99
|
};
|
|
109
|
-
|
|
110
|
-
var getLabelOrientation = function (degree, labelPlacement) {
|
|
100
|
+
const getLabelOrientation = (degree, labelPlacement) => {
|
|
111
101
|
if (labelPlacement === "perpendicular") {
|
|
112
102
|
return degree > 90 && degree < 270 ? "bottom" : "top";
|
|
113
103
|
} else if (labelPlacement === "parallel") {
|
|
114
104
|
return degree >= 0 && degree <= 180 ? "right" : "left";
|
|
115
105
|
}
|
|
116
|
-
|
|
117
106
|
if (degree < 45 || degree > 315) {
|
|
118
107
|
return "top";
|
|
119
108
|
} else if (degree >= 45 && degree < 135) {
|
|
@@ -121,29 +110,22 @@ var getLabelOrientation = function (degree, labelPlacement) {
|
|
|
121
110
|
} else if (degree >= 135 && degree < 225) {
|
|
122
111
|
return "bottom";
|
|
123
112
|
}
|
|
124
|
-
|
|
125
113
|
return "left";
|
|
126
114
|
};
|
|
127
|
-
|
|
128
|
-
var getTextAnchor = function (orientation) {
|
|
115
|
+
const getTextAnchor = orientation => {
|
|
129
116
|
if (orientation === "top" || orientation === "bottom") {
|
|
130
117
|
return "middle";
|
|
131
118
|
}
|
|
132
|
-
|
|
133
119
|
return orientation === "right" ? "start" : "end";
|
|
134
120
|
};
|
|
135
|
-
|
|
136
|
-
var getVerticalAnchor = function (orientation) {
|
|
121
|
+
const getVerticalAnchor = orientation => {
|
|
137
122
|
if (orientation === "left" || orientation === "right") {
|
|
138
123
|
return "middle";
|
|
139
124
|
}
|
|
140
|
-
|
|
141
125
|
return orientation === "bottom" ? "start" : "end";
|
|
142
126
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var baseAngle = 0;
|
|
146
|
-
|
|
127
|
+
const getBaseLabelAngle = (slice, labelPosition, labelStyle) => {
|
|
128
|
+
let baseAngle = 0;
|
|
147
129
|
if (labelPosition.angle !== undefined) {
|
|
148
130
|
baseAngle = labelStyle.angle;
|
|
149
131
|
} else if (labelPosition === "centroid") {
|
|
@@ -151,204 +133,192 @@ var getBaseLabelAngle = function (slice, labelPosition, labelStyle) {
|
|
|
151
133
|
} else {
|
|
152
134
|
baseAngle = labelPosition === "startAngle" ? Helpers.radiansToDegrees(slice.startAngle) : Helpers.radiansToDegrees(slice.endAngle);
|
|
153
135
|
}
|
|
154
|
-
|
|
155
|
-
var positiveAngle = baseAngle < 0 ? 360 - baseAngle : baseAngle;
|
|
136
|
+
const positiveAngle = baseAngle < 0 ? 360 - baseAngle : baseAngle;
|
|
156
137
|
return positiveAngle % 360;
|
|
157
138
|
};
|
|
158
|
-
|
|
159
|
-
var getLabelAngle = function (baseAngle, labelPlacement) {
|
|
139
|
+
const getLabelAngle = (baseAngle, labelPlacement) => {
|
|
160
140
|
if (labelPlacement === "vertical") {
|
|
161
141
|
return 0;
|
|
162
142
|
}
|
|
163
|
-
|
|
164
143
|
if (labelPlacement === "parallel") {
|
|
165
144
|
return baseAngle > 180 && baseAngle < 360 ? baseAngle + 90 : baseAngle - 90;
|
|
166
145
|
}
|
|
167
|
-
|
|
168
146
|
return baseAngle > 90 && baseAngle < 270 ? baseAngle - 180 : baseAngle;
|
|
169
147
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
148
|
+
const getLabelProps = (text, dataProps, calculatedValues) => {
|
|
149
|
+
const {
|
|
150
|
+
index,
|
|
151
|
+
datum,
|
|
152
|
+
data,
|
|
153
|
+
slice,
|
|
154
|
+
labelComponent,
|
|
155
|
+
theme
|
|
156
|
+
} = dataProps;
|
|
157
|
+
const {
|
|
158
|
+
style,
|
|
159
|
+
defaultRadius,
|
|
160
|
+
origin,
|
|
161
|
+
width,
|
|
162
|
+
height
|
|
163
|
+
} = calculatedValues;
|
|
164
|
+
const labelRadius = Helpers.evaluateProp(calculatedValues.labelRadius, Object.assign({
|
|
165
|
+
text
|
|
185
166
|
}, dataProps));
|
|
186
|
-
|
|
187
|
-
text
|
|
167
|
+
const labelPosition = Helpers.evaluateProp(calculatedValues.labelPosition, Object.assign({
|
|
168
|
+
text
|
|
188
169
|
}, dataProps)) || "centroid";
|
|
189
|
-
|
|
190
|
-
text
|
|
170
|
+
const labelPlacement = Helpers.evaluateProp(calculatedValues.labelPlacement, Object.assign({
|
|
171
|
+
text
|
|
191
172
|
}, dataProps)) || "vertical";
|
|
192
|
-
|
|
173
|
+
const labelStyle = Object.assign({
|
|
193
174
|
padding: 0
|
|
194
175
|
}, style.labels);
|
|
195
|
-
|
|
196
|
-
labelRadius
|
|
197
|
-
text
|
|
176
|
+
const evaluatedStyle = Helpers.evaluateStyle(labelStyle, Object.assign({
|
|
177
|
+
labelRadius,
|
|
178
|
+
text
|
|
198
179
|
}, dataProps));
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
width
|
|
209
|
-
height
|
|
210
|
-
index
|
|
211
|
-
datum
|
|
212
|
-
data
|
|
213
|
-
slice
|
|
214
|
-
orientation
|
|
215
|
-
text
|
|
180
|
+
const calculatedLabelRadius = getCalculatedLabelRadius(defaultRadius, labelRadius, evaluatedStyle);
|
|
181
|
+
const labelArc = getLabelArc(calculatedLabelRadius);
|
|
182
|
+
const position = getLabelPosition(labelArc, slice, labelPosition);
|
|
183
|
+
const baseAngle = getBaseLabelAngle(slice, labelPosition, labelStyle);
|
|
184
|
+
const labelAngle = getLabelAngle(baseAngle, labelPlacement);
|
|
185
|
+
const orientation = getLabelOrientation(baseAngle, labelPlacement);
|
|
186
|
+
const textAnchor = labelStyle.textAnchor || getTextAnchor(orientation);
|
|
187
|
+
const verticalAnchor = labelStyle.verticalAnchor || getVerticalAnchor(orientation);
|
|
188
|
+
const labelProps = {
|
|
189
|
+
width,
|
|
190
|
+
height,
|
|
191
|
+
index,
|
|
192
|
+
datum,
|
|
193
|
+
data,
|
|
194
|
+
slice,
|
|
195
|
+
orientation,
|
|
196
|
+
text,
|
|
216
197
|
style: labelStyle,
|
|
217
198
|
x: Math.round(position[0]) + origin.x,
|
|
218
199
|
y: Math.round(position[1]) + origin.y,
|
|
219
|
-
textAnchor
|
|
220
|
-
verticalAnchor
|
|
200
|
+
textAnchor,
|
|
201
|
+
verticalAnchor,
|
|
221
202
|
angle: labelAngle,
|
|
222
|
-
calculatedLabelRadius
|
|
203
|
+
calculatedLabelRadius
|
|
223
204
|
};
|
|
224
|
-
|
|
225
205
|
if (!Helpers.isTooltip(labelComponent)) {
|
|
226
206
|
return labelProps;
|
|
227
207
|
}
|
|
228
|
-
|
|
229
|
-
var tooltipTheme = theme && theme.tooltip || {};
|
|
208
|
+
const tooltipTheme = theme && theme.tooltip || {};
|
|
230
209
|
return _defaults({}, labelProps, Helpers.omit(tooltipTheme, ["style"]));
|
|
231
210
|
};
|
|
232
|
-
|
|
233
|
-
export
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
export
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
var labelIndicatorProps = {
|
|
274
|
-
x1: x1,
|
|
275
|
-
y1: y1,
|
|
276
|
-
x2: x2,
|
|
277
|
-
y2: y2,
|
|
278
|
-
index: index
|
|
211
|
+
export const getXOffsetMultiplayerByAngle = angle => Math.cos(angle - Helpers.degreesToRadians(90));
|
|
212
|
+
export const getYOffsetMultiplayerByAngle = angle => Math.sin(angle - Helpers.degreesToRadians(90));
|
|
213
|
+
export const getXOffset = (offset, angle) => offset * getXOffsetMultiplayerByAngle(angle);
|
|
214
|
+
export const getYOffset = (offset, angle) => offset * getYOffsetMultiplayerByAngle(angle);
|
|
215
|
+
export const getAverage = array => array.reduce((acc, cur) => acc + cur, 0) / array.length;
|
|
216
|
+
export const getLabelIndicatorPropsForLineSegment = (props, calculatedValues, labelProps) => {
|
|
217
|
+
const {
|
|
218
|
+
innerRadius,
|
|
219
|
+
radius,
|
|
220
|
+
slice: {
|
|
221
|
+
startAngle,
|
|
222
|
+
endAngle
|
|
223
|
+
},
|
|
224
|
+
labelIndicatorInnerOffset,
|
|
225
|
+
labelIndicatorOuterOffset,
|
|
226
|
+
index
|
|
227
|
+
} = props;
|
|
228
|
+
const {
|
|
229
|
+
height,
|
|
230
|
+
width
|
|
231
|
+
} = calculatedValues;
|
|
232
|
+
const {
|
|
233
|
+
calculatedLabelRadius
|
|
234
|
+
} = labelProps;
|
|
235
|
+
// calculation
|
|
236
|
+
const middleRadius = getAverage([innerRadius, radius]);
|
|
237
|
+
const midAngle = getAverage([endAngle, startAngle]);
|
|
238
|
+
const centerX = width / 2;
|
|
239
|
+
const centerY = height / 2;
|
|
240
|
+
const innerOffset = middleRadius + labelIndicatorInnerOffset;
|
|
241
|
+
const outerOffset = calculatedLabelRadius - labelIndicatorOuterOffset;
|
|
242
|
+
const x1 = centerX + getXOffset(innerOffset, midAngle);
|
|
243
|
+
const y1 = centerY + getYOffset(innerOffset, midAngle);
|
|
244
|
+
const x2 = centerX + getXOffset(outerOffset, midAngle);
|
|
245
|
+
const y2 = centerY + getYOffset(outerOffset, midAngle);
|
|
246
|
+
const labelIndicatorProps = {
|
|
247
|
+
x1,
|
|
248
|
+
y1,
|
|
249
|
+
x2,
|
|
250
|
+
y2,
|
|
251
|
+
index
|
|
279
252
|
};
|
|
280
253
|
return _defaults({}, labelIndicatorProps);
|
|
281
254
|
};
|
|
282
|
-
export
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
255
|
+
export const getBaseProps = (initialProps, fallbackProps) => {
|
|
256
|
+
const props = Helpers.modifyProps(initialProps, fallbackProps, "pie");
|
|
257
|
+
const calculatedValues = getCalculatedValues(props);
|
|
258
|
+
const {
|
|
259
|
+
slices,
|
|
260
|
+
style,
|
|
261
|
+
data,
|
|
262
|
+
origin,
|
|
263
|
+
defaultRadius,
|
|
264
|
+
labels,
|
|
265
|
+
events,
|
|
266
|
+
sharedEvents,
|
|
267
|
+
height,
|
|
268
|
+
width,
|
|
269
|
+
standalone,
|
|
270
|
+
name,
|
|
271
|
+
innerRadius,
|
|
272
|
+
cornerRadius,
|
|
273
|
+
padAngle,
|
|
274
|
+
disableInlineStyles,
|
|
275
|
+
labelIndicator
|
|
276
|
+
} = calculatedValues;
|
|
277
|
+
const radius = props.radius || defaultRadius;
|
|
278
|
+
const initialChildProps = {
|
|
304
279
|
parent: {
|
|
305
|
-
standalone
|
|
306
|
-
height
|
|
307
|
-
width
|
|
308
|
-
slices
|
|
309
|
-
name
|
|
280
|
+
standalone,
|
|
281
|
+
height,
|
|
282
|
+
width,
|
|
283
|
+
slices,
|
|
284
|
+
name,
|
|
310
285
|
style: style.parent
|
|
311
286
|
}
|
|
312
287
|
};
|
|
313
|
-
return slices.reduce(
|
|
314
|
-
|
|
288
|
+
return slices.reduce((childProps, slice, index) => {
|
|
289
|
+
const datum = _defaults({}, data[index], {
|
|
315
290
|
startAngle: Helpers.radiansToDegrees(slice.startAngle),
|
|
316
291
|
endAngle: Helpers.radiansToDegrees(slice.endAngle),
|
|
317
292
|
padAngle: Helpers.radiansToDegrees(slice.padAngle)
|
|
318
293
|
});
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
padAngle: padAngle,
|
|
294
|
+
const eventKey = !Helpers.isNil(datum.eventKey) ? datum.eventKey : index;
|
|
295
|
+
const dataProps = {
|
|
296
|
+
index,
|
|
297
|
+
slice,
|
|
298
|
+
datum,
|
|
299
|
+
data,
|
|
300
|
+
origin,
|
|
301
|
+
innerRadius,
|
|
302
|
+
radius,
|
|
303
|
+
cornerRadius,
|
|
304
|
+
padAngle,
|
|
331
305
|
style: disableInlineStyles ? {} : getSliceStyle(index, calculatedValues),
|
|
332
|
-
disableInlineStyles
|
|
306
|
+
disableInlineStyles
|
|
333
307
|
};
|
|
334
308
|
childProps[eventKey] = {
|
|
335
309
|
data: dataProps
|
|
336
310
|
};
|
|
337
|
-
|
|
338
|
-
|
|
311
|
+
const text = getLabelText(props, datum, index);
|
|
339
312
|
if (text !== undefined && text !== null || labels && (events || sharedEvents)) {
|
|
340
|
-
|
|
313
|
+
const evaluatedText = Helpers.evaluateProp(text, dataProps);
|
|
341
314
|
childProps[eventKey].labels = getLabelProps(evaluatedText, Object.assign({}, props, dataProps), calculatedValues);
|
|
342
|
-
|
|
343
315
|
if (labelIndicator) {
|
|
344
|
-
|
|
345
|
-
|
|
316
|
+
const labelProps = childProps[eventKey].labels;
|
|
346
317
|
if (labelProps.calculatedLabelRadius > radius) {
|
|
347
318
|
childProps[eventKey].labelIndicators = getLabelIndicatorPropsForLineSegment(Object.assign({}, props, dataProps), calculatedValues, labelProps);
|
|
348
319
|
}
|
|
349
320
|
}
|
|
350
321
|
}
|
|
351
|
-
|
|
352
322
|
return childProps;
|
|
353
323
|
}, initialChildProps);
|
|
354
324
|
};
|