victory-tooltip 30.6.1 → 31.2.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.
@@ -79,14 +79,12 @@ function (_React$Component) {
79
79
  }, {
80
80
  key: "getVerticalOrientations",
81
81
  value: function getVerticalOrientations(degrees) {
82
+ // eslint-disable-next-line no-magic-numbers
82
83
  if (degrees < 45 || degrees > 315) {
83
- // eslint-disable-line no-magic-numbers
84
- return "right";
84
+ return "right"; // eslint-disable-next-line no-magic-numbers
85
85
  } else if (degrees >= 45 && degrees <= 135) {
86
- // eslint-disable-line no-magic-numbers
87
- return "top";
86
+ return "top"; // eslint-disable-next-line no-magic-numbers
88
87
  } else if (degrees > 135 && degrees < 225) {
89
- // eslint-disable-line no-magic-numbers
90
88
  return "left";
91
89
  } else {
92
90
  return "bottom";
@@ -95,14 +95,12 @@ function (_React$Component) {
95
95
  }, {
96
96
  key: "getVerticalOrientations",
97
97
  value: function getVerticalOrientations(degrees) {
98
+ // eslint-disable-next-line no-magic-numbers
98
99
  if (degrees < 45 || degrees > 315) {
99
- // eslint-disable-line no-magic-numbers
100
- return "right";
100
+ return "right"; // eslint-disable-next-line no-magic-numbers
101
101
  } else if (degrees >= 45 && degrees <= 135) {
102
- // eslint-disable-line no-magic-numbers
103
- return "top";
102
+ return "top"; // eslint-disable-next-line no-magic-numbers
104
103
  } else if (degrees > 135 && degrees < 225) {
105
- // eslint-disable-line no-magic-numbers
106
104
  return "left";
107
105
  } else {
108
106
  return "bottom";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-tooltip",
3
- "version": "30.6.1",
3
+ "version": "31.2.0",
4
4
  "description": "Tooltip Component for Victory",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "lodash": "^4.17.5",
23
23
  "prop-types": "^15.5.8",
24
- "victory-core": "^30.6.1"
24
+ "victory-core": "^31.2.0"
25
25
  },
26
26
  "scripts": {
27
27
  "version": "nps build-libs && nps build-dists"
package/src/flyout.js CHANGED
@@ -4,7 +4,6 @@ import PropTypes from "prop-types";
4
4
  import { Helpers, CommonProps, Path } from "victory-core";
5
5
 
6
6
  export default class Flyout extends React.Component {
7
-
8
7
  static propTypes = {
9
8
  ...CommonProps.primitiveProps,
10
9
  cornerRadius: PropTypes.number,
@@ -22,7 +21,7 @@ export default class Flyout extends React.Component {
22
21
  };
23
22
 
24
23
  static defaultProps = {
25
- pathComponent: <Path/>
24
+ pathComponent: <Path />
26
25
  };
27
26
 
28
27
  getVerticalPath(props) {
@@ -30,10 +29,10 @@ export default class Flyout extends React.Component {
30
29
  const sign = orientation === "top" ? 1 : -1;
31
30
  const x = props.x + (props.dx || 0);
32
31
  const y = props.y - sign * (props.dy || 0);
33
- const pointerEdge = y - (sign * pointerLength);
34
- const oppositeEdge = y - (sign * pointerLength) - (sign * height);
35
- const rightEdge = x + (width / 2);
36
- const leftEdge = x - (width / 2);
32
+ const pointerEdge = y - sign * pointerLength;
33
+ const oppositeEdge = y - sign * pointerLength - sign * height;
34
+ const rightEdge = x + width / 2;
35
+ const leftEdge = x - width / 2;
37
36
  const direction = orientation === "top" ? "0 0 0" : "0 0 1";
38
37
  const arc = `${cornerRadius} ${cornerRadius} ${direction}`;
39
38
  return `M ${x - pointerWidth / 2}, ${pointerEdge}
@@ -56,7 +55,7 @@ export default class Flyout extends React.Component {
56
55
  const x = props.x + sign * (props.dx || 0);
57
56
  const y = props.y - (props.dy || 0);
58
57
  const pointerEdge = x + sign * pointerLength;
59
- const oppositeEdge = x + (sign * pointerLength) + (sign * width);
58
+ const oppositeEdge = x + sign * pointerLength + sign * width;
60
59
  const bottomEdge = y + height / 2;
61
60
  const topEdge = y - height / 2;
62
61
  const direction = orientation === "right" ? "0 0 0" : "0 0 1";
@@ -77,19 +76,34 @@ export default class Flyout extends React.Component {
77
76
 
78
77
  getFlyoutPath(props) {
79
78
  const orientation = props.orientation || "top";
80
- return orientation === "left" || orientation === "right" ?
81
- this.getHorizontalPath(props) : this.getVerticalPath(props);
79
+ return orientation === "left" || orientation === "right"
80
+ ? this.getHorizontalPath(props)
81
+ : this.getVerticalPath(props);
82
82
  }
83
83
 
84
84
  render() {
85
85
  const {
86
- datum, active, role, shapeRendering, className, events, pathComponent, transform, clipPath
86
+ datum,
87
+ active,
88
+ role,
89
+ shapeRendering,
90
+ className,
91
+ events,
92
+ pathComponent,
93
+ transform,
94
+ clipPath
87
95
  } = this.props;
88
96
  const style = Helpers.evaluateStyle(this.props.style, datum, active);
89
97
  const path = this.getFlyoutPath(this.props);
90
- return React.cloneElement(
91
- pathComponent,
92
- { style, className, shapeRendering, role, events, transform, d: path, clipPath }
93
- );
98
+ return React.cloneElement(pathComponent, {
99
+ style,
100
+ className,
101
+ shapeRendering,
102
+ role,
103
+ events,
104
+ transform,
105
+ d: path,
106
+ clipPath
107
+ });
94
108
  }
95
109
  }
@@ -1,7 +1,12 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import {
4
- PropTypes as CustomPropTypes, TextSize, Helpers, LabelHelpers, VictoryLabel, VictoryTheme,
4
+ PropTypes as CustomPropTypes,
5
+ TextSize,
6
+ Helpers,
7
+ LabelHelpers,
8
+ VictoryLabel,
9
+ VictoryTheme,
5
10
  VictoryPortal
6
11
  } from "victory-core";
7
12
  import Flyout from "./flyout";
@@ -18,33 +23,18 @@ export default class VictoryTooltip extends React.Component {
18
23
 
19
24
  static propTypes = {
20
25
  activateData: PropTypes.bool,
21
- active: PropTypes.oneOfType([
22
- PropTypes.bool,
23
- PropTypes.func
24
- ]),
26
+ active: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
25
27
  angle: PropTypes.number,
26
- cornerRadius: PropTypes.oneOfType([
27
- CustomPropTypes.nonNegative,
28
- PropTypes.func
29
- ]),
28
+ cornerRadius: PropTypes.oneOfType([CustomPropTypes.nonNegative, PropTypes.func]),
30
29
  data: PropTypes.array,
31
30
  datum: PropTypes.object,
32
- dx: PropTypes.oneOfType([
33
- PropTypes.number,
34
- PropTypes.func
35
- ]),
36
- dy: PropTypes.oneOfType([
37
- PropTypes.number,
38
- PropTypes.func
39
- ]),
31
+ dx: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
32
+ dy: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
40
33
  events: PropTypes.object,
41
34
  flyoutComponent: PropTypes.element,
42
35
  flyoutStyle: PropTypes.object,
43
36
  groupComponent: PropTypes.element,
44
- height: PropTypes.oneOfType([
45
- CustomPropTypes.nonNegative,
46
- PropTypes.func
47
- ]),
37
+ height: PropTypes.oneOfType([CustomPropTypes.nonNegative, PropTypes.func]),
48
38
  horizontal: PropTypes.bool,
49
39
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
50
40
  index: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -53,20 +43,11 @@ export default class VictoryTooltip extends React.Component {
53
43
  PropTypes.oneOf(["top", "bottom", "left", "right"]),
54
44
  PropTypes.func
55
45
  ]),
56
- pointerLength: PropTypes.oneOfType([
57
- CustomPropTypes.nonNegative,
58
- PropTypes.func
59
- ]),
60
- pointerWidth: PropTypes.oneOfType([
61
- CustomPropTypes.nonNegative,
62
- PropTypes.func
63
- ]),
46
+ pointerLength: PropTypes.oneOfType([CustomPropTypes.nonNegative, PropTypes.func]),
47
+ pointerWidth: PropTypes.oneOfType([CustomPropTypes.nonNegative, PropTypes.func]),
64
48
  polar: PropTypes.bool,
65
49
  renderInPortal: PropTypes.bool,
66
- style: PropTypes.oneOfType([
67
- PropTypes.object,
68
- PropTypes.array
69
- ]),
50
+ style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
70
51
  text: PropTypes.oneOfType([
71
52
  PropTypes.string,
72
53
  PropTypes.number,
@@ -74,10 +55,7 @@ export default class VictoryTooltip extends React.Component {
74
55
  PropTypes.array
75
56
  ]),
76
57
  theme: PropTypes.object,
77
- width: PropTypes.oneOfType([
78
- CustomPropTypes.nonNegative,
79
- PropTypes.func
80
- ]),
58
+ width: PropTypes.oneOfType([CustomPropTypes.nonNegative, PropTypes.func]),
81
59
  x: PropTypes.number,
82
60
  y: PropTypes.number
83
61
  };
@@ -85,55 +63,56 @@ export default class VictoryTooltip extends React.Component {
85
63
  static defaultProps = {
86
64
  active: false,
87
65
  renderInPortal: true,
88
- labelComponent: <VictoryLabel/>,
89
- flyoutComponent: <Flyout/>,
90
- groupComponent: <g/>
66
+ labelComponent: <VictoryLabel />,
67
+ flyoutComponent: <Flyout />,
68
+ groupComponent: <g />
91
69
  };
92
70
 
93
71
  static defaultEvents = (props) => {
94
- return [{
95
- target: "data",
96
- eventHandlers: {
97
- onMouseOver: () => {
98
- return props.activateData ?
99
- [
100
- { target: "labels", mutation: () => ({ active: true }) },
101
- { target: "data", mutation: () => ({ active: true }) }
102
- ] :
103
- [{ target: "labels", mutation: () => ({ active: true }) }];
104
- },
105
- onTouchStart: () => {
106
- return props.activateData ?
107
- [
108
- { target: "labels", mutation: () => ({ active: true }) },
109
- { target: "data", mutation: () => ({ active: true }) }
110
- ] :
111
- [{ target: "labels", mutation: () => ({ active: true }) }];
112
- },
113
- onMouseOut: () => {
114
- return props.activateData ?
115
- [
116
- { target: "labels", mutation: () => ({ active: undefined }) },
117
- { target: "data", mutation: () => ({ active: undefined }) }
118
- ] :
119
- [{ target: "labels", mutation: () => ({ active: undefined }) }];
120
- },
121
- onTouchEnd: () => {
122
- return props.activateData ?
123
- [
124
- { target: "labels", mutation: () => ({ active: undefined }) },
125
- { target: "data", mutation: () => ({ active: undefined }) }
126
- ] :
127
- [{ target: "labels", mutation: () => ({ active: undefined }) }];
72
+ return [
73
+ {
74
+ target: "data",
75
+ eventHandlers: {
76
+ onMouseOver: () => {
77
+ return props.activateData
78
+ ? [
79
+ { target: "labels", mutation: () => ({ active: true }) },
80
+ { target: "data", mutation: () => ({ active: true }) }
81
+ ]
82
+ : [{ target: "labels", mutation: () => ({ active: true }) }];
83
+ },
84
+ onTouchStart: () => {
85
+ return props.activateData
86
+ ? [
87
+ { target: "labels", mutation: () => ({ active: true }) },
88
+ { target: "data", mutation: () => ({ active: true }) }
89
+ ]
90
+ : [{ target: "labels", mutation: () => ({ active: true }) }];
91
+ },
92
+ onMouseOut: () => {
93
+ return props.activateData
94
+ ? [
95
+ { target: "labels", mutation: () => ({ active: undefined }) },
96
+ { target: "data", mutation: () => ({ active: undefined }) }
97
+ ]
98
+ : [{ target: "labels", mutation: () => ({ active: undefined }) }];
99
+ },
100
+ onTouchEnd: () => {
101
+ return props.activateData
102
+ ? [
103
+ { target: "labels", mutation: () => ({ active: undefined }) },
104
+ { target: "data", mutation: () => ({ active: undefined }) }
105
+ ]
106
+ : [{ target: "labels", mutation: () => ({ active: undefined }) }];
107
+ }
128
108
  }
129
109
  }
130
- }];
110
+ ];
131
111
  };
132
112
 
133
113
  constructor(props) {
134
114
  super(props);
135
- this.id = props.id === undefined ?
136
- uniqueId("tooltip-") : props.id;
115
+ this.id = props.id === undefined ? uniqueId("tooltip-") : props.id;
137
116
  }
138
117
 
139
118
  getDefaultOrientation(props) {
@@ -160,11 +139,14 @@ export default class VictoryTooltip extends React.Component {
160
139
  }
161
140
 
162
141
  getVerticalOrientations(degrees) {
163
- if (degrees < 45 || degrees > 315) { // eslint-disable-line no-magic-numbers
142
+ // eslint-disable-next-line no-magic-numbers
143
+ if (degrees < 45 || degrees > 315) {
164
144
  return "right";
165
- } else if (degrees >= 45 && degrees <= 135) { // eslint-disable-line no-magic-numbers
145
+ // eslint-disable-next-line no-magic-numbers
146
+ } else if (degrees >= 45 && degrees <= 135) {
166
147
  return "top";
167
- } else if (degrees > 135 && degrees < 225) { // eslint-disable-line no-magic-numbers
148
+ // eslint-disable-next-line no-magic-numbers
149
+ } else if (degrees > 135 && degrees < 225) {
168
150
  return "left";
169
151
  } else {
170
152
  return "bottom";
@@ -173,59 +155,72 @@ export default class VictoryTooltip extends React.Component {
173
155
 
174
156
  getEvaluatedProps(props) {
175
157
  const {
176
- horizontal, datum, pointerLength, pointerWidth, cornerRadius,
177
- width, height, dx, dy, text, active
158
+ horizontal,
159
+ datum,
160
+ pointerLength,
161
+ pointerWidth,
162
+ cornerRadius,
163
+ width,
164
+ height,
165
+ dx,
166
+ dy,
167
+ text,
168
+ active
178
169
  } = props;
179
170
 
180
- const style = Array.isArray(props.style) ?
181
- props.style.map((s) => Helpers.evaluateStyle(s, datum, active)) :
182
- Helpers.evaluateStyle(props.style, datum, active);
171
+ const style = Array.isArray(props.style)
172
+ ? props.style.map((s) => Helpers.evaluateStyle(s, datum, active))
173
+ : Helpers.evaluateStyle(props.style, datum, active);
183
174
  const flyoutStyle = Helpers.evaluateStyle(props.flyoutStyle, datum, active);
184
- const padding = flyoutStyle && flyoutStyle.padding || 0;
175
+ const padding = (flyoutStyle && flyoutStyle.padding) || 0;
185
176
  const defaultDx = horizontal ? padding : 0;
186
177
  const defaultDy = horizontal ? 0 : padding;
187
- const orientation = Helpers.evaluateProp(props.orientation, datum, active) ||
188
- this.getDefaultOrientation(props);
189
- return assign(
190
- {},
191
- props,
192
- {
193
- style,
194
- flyoutStyle,
195
- orientation,
196
- dx: dx !== undefined ? Helpers.evaluateProp(dx, datum, active) : defaultDx,
197
- dy: dy !== undefined ? Helpers.evaluateProp(dy, datum, active) : defaultDy,
198
- cornerRadius: Helpers.evaluateProp(cornerRadius, datum, active),
199
- pointerLength: Helpers.evaluateProp(pointerLength, datum, active),
200
- pointerWidth: Helpers.evaluateProp(pointerWidth, datum, active),
201
- width: Helpers.evaluateProp(width, datum, active),
202
- height: Helpers.evaluateProp(height, datum, active),
203
- active: Helpers.evaluateProp(active, datum, active),
204
- text: Helpers.evaluateProp(text, datum, active)
205
- }
206
- );
178
+ const orientation =
179
+ Helpers.evaluateProp(props.orientation, datum, active) || this.getDefaultOrientation(props);
180
+ return assign({}, props, {
181
+ style,
182
+ flyoutStyle,
183
+ orientation,
184
+ dx: dx !== undefined ? Helpers.evaluateProp(dx, datum, active) : defaultDx,
185
+ dy: dy !== undefined ? Helpers.evaluateProp(dy, datum, active) : defaultDy,
186
+ cornerRadius: Helpers.evaluateProp(cornerRadius, datum, active),
187
+ pointerLength: Helpers.evaluateProp(pointerLength, datum, active),
188
+ pointerWidth: Helpers.evaluateProp(pointerWidth, datum, active),
189
+ width: Helpers.evaluateProp(width, datum, active),
190
+ height: Helpers.evaluateProp(height, datum, active),
191
+ active: Helpers.evaluateProp(active, datum, active),
192
+ text: Helpers.evaluateProp(text, datum, active)
193
+ });
207
194
  }
208
195
 
209
196
  getCalculatedValues(props) {
210
197
  const { style, text, datum, active } = props;
211
198
  const theme = props.theme || VictoryTheme.grayscale;
212
- const defaultLabelStyles = theme && theme.tooltip && theme.tooltip.style ?
213
- theme.tooltip.style : {};
214
- const baseLabelStyle = Array.isArray(style) ?
215
- style.map((s) => defaults({}, s, defaultLabelStyles)) :
216
- defaults({}, style, defaultLabelStyles);
217
- const defaultFlyoutStyles = theme && theme.tooltip && theme.tooltip.flyoutStyle ?
218
- theme.tooltip.flyoutStyle : {};
219
- const flyoutStyle = props.flyoutStyle ?
220
- defaults({}, props.flyoutStyle, defaultFlyoutStyles) : defaultFlyoutStyles;
221
- const labelStyle = Array.isArray(baseLabelStyle) ?
222
- baseLabelStyle.map((s) => Helpers.evaluateStyle(s, datum, active)) :
223
- Helpers.evaluateStyle(baseLabelStyle, datum, active);
199
+ const defaultLabelStyles =
200
+ theme && theme.tooltip && theme.tooltip.style ? theme.tooltip.style : {};
201
+ const baseLabelStyle = Array.isArray(style)
202
+ ? style.map((s) => defaults({}, s, defaultLabelStyles))
203
+ : defaults({}, style, defaultLabelStyles);
204
+ const defaultFlyoutStyles =
205
+ theme && theme.tooltip && theme.tooltip.flyoutStyle ? theme.tooltip.flyoutStyle : {};
206
+ const flyoutStyle = props.flyoutStyle
207
+ ? defaults({}, props.flyoutStyle, defaultFlyoutStyles)
208
+ : defaultFlyoutStyles;
209
+ const labelStyle = Array.isArray(baseLabelStyle)
210
+ ? baseLabelStyle.map((s) => Helpers.evaluateStyle(s, datum, active))
211
+ : Helpers.evaluateStyle(baseLabelStyle, datum, active);
224
212
  const labelSize = TextSize.approximateTextSize(text, labelStyle);
225
213
  const flyoutDimensions = this.getDimensions(props, labelSize, labelStyle);
226
214
  const flyoutCenter = this.getFlyoutCenter(props, flyoutDimensions);
227
215
  const transform = this.getTransform(props);
228
- return { labelStyle, flyoutStyle, labelSize, flyoutDimensions, flyoutCenter, transform };
216
+ return {
217
+ labelStyle,
218
+ flyoutStyle,
219
+ labelSize,
220
+ flyoutDimensions,
221
+ flyoutCenter,
222
+ transform
223
+ };
229
224
  }
230
225
 
231
226
  getTransform(props) {
@@ -233,7 +228,6 @@ export default class VictoryTooltip extends React.Component {
233
228
  const labelStyle = style || {};
234
229
  const angle = labelStyle.angle || props.angle || this.getDefaultAngle(props);
235
230
  return angle ? `rotate(${angle} ${x} ${y})` : undefined;
236
-
237
231
  }
238
232
 
239
233
  // eslint-disable-next-line complexity
@@ -243,7 +237,7 @@ export default class VictoryTooltip extends React.Component {
243
237
  return 0;
244
238
  }
245
239
  const degrees = LabelHelpers.getDegrees(props, datum);
246
- const sign = (degrees > 90 && degrees < 180 || degrees > 270) ? 1 : -1;
240
+ const sign = (degrees > 90 && degrees < 180) || degrees > 270 ? 1 : -1;
247
241
  const labelRotation = labelPlacement === "perpendicular" ? 0 : 90;
248
242
  let angle;
249
243
  if (degrees === 0 || degrees === 180) {
@@ -262,10 +256,14 @@ export default class VictoryTooltip extends React.Component {
262
256
  const xSign = orientation === "left" ? -1 : 1;
263
257
  const ySign = orientation === "bottom" ? -1 : 1;
264
258
  return {
265
- x: orientation === "left" || orientation === "right" ?
266
- x + xSign * (pointerLength + (width / 2) + dx) : x + dx,
267
- y: orientation === "top" || orientation === "bottom" ?
268
- y - ySign * (pointerLength + (height / 2) + dy) : y - dy
259
+ x:
260
+ orientation === "left" || orientation === "right"
261
+ ? x + xSign * (pointerLength + width / 2 + dx)
262
+ : x + dx,
263
+ y:
264
+ orientation === "top" || orientation === "bottom"
265
+ ? y - ySign * (pointerLength + height / 2 + dy)
266
+ : y - dy
269
267
  };
270
268
  }
271
269
 
@@ -282,18 +280,22 @@ export default class VictoryTooltip extends React.Component {
282
280
  const padding = this.getLabelPadding(labelStyle);
283
281
  const getHeight = () => {
284
282
  const calculatedHeight = labelSize.height + padding;
285
- const minHeight = orientation === "top" || orientation === "bottom" ?
286
- 2 * cornerRadius : 2 * cornerRadius + pointerWidth;
283
+ const minHeight =
284
+ orientation === "top" || orientation === "bottom"
285
+ ? 2 * cornerRadius
286
+ : 2 * cornerRadius + pointerWidth;
287
287
  return Math.max(minHeight, calculatedHeight);
288
288
  };
289
289
  const getWidth = () => {
290
290
  const calculatedWidth = labelSize.width + padding;
291
- const minWidth = orientation === "left" || orientation === "right" ?
292
- 2 * cornerRadius + pointerLength : 2 * cornerRadius;
291
+ const minWidth =
292
+ orientation === "left" || orientation === "right"
293
+ ? 2 * cornerRadius + pointerLength
294
+ : 2 * cornerRadius;
293
295
  return Math.max(minWidth, calculatedWidth);
294
296
  };
295
297
  return {
296
- height: props.height || getHeight(props, labelSize, orientation) + (padding / 2),
298
+ height: props.height || getHeight(props, labelSize, orientation) + padding / 2,
297
299
  width: props.width || getWidth(props, labelSize, orientation) + padding
298
300
  };
299
301
  }
@@ -301,53 +303,73 @@ export default class VictoryTooltip extends React.Component {
301
303
  getLabelProps(props, calculatedValues) {
302
304
  const { flyoutCenter, labelStyle, labelSize, dy, dx } = calculatedValues;
303
305
  const { text, datum, labelComponent, index } = props;
304
- const textAnchor = (Array.isArray(labelStyle) && labelStyle.length ?
305
- labelStyle[0].textAnchor :
306
- labelStyle.textAnchor) || "middle";
306
+ const textAnchor =
307
+ (Array.isArray(labelStyle) && labelStyle.length
308
+ ? labelStyle[0].textAnchor
309
+ : labelStyle.textAnchor) || "middle";
307
310
  const getLabelX = () => {
308
311
  const sign = textAnchor === "end" ? -1 : 1;
309
312
  return flyoutCenter.x - sign * (labelSize.width / 2);
310
313
  };
311
- return defaults(
312
- {},
313
- labelComponent.props,
314
- {
315
- key: `${this.id}-label-${index}`,
316
- text, datum, textAnchor, dy, dx,
317
- style: labelStyle,
318
- x: !textAnchor || textAnchor === "middle" ?
319
- flyoutCenter.x : getLabelX(),
320
- y: flyoutCenter.y,
321
- verticalAnchor: "middle",
322
- angle: labelStyle.angle
323
- }
324
- );
314
+ return defaults({}, labelComponent.props, {
315
+ key: `${this.id}-label-${index}`,
316
+ text,
317
+ datum,
318
+ textAnchor,
319
+ dy,
320
+ dx,
321
+ style: labelStyle,
322
+ x: !textAnchor || textAnchor === "middle" ? flyoutCenter.x : getLabelX(),
323
+ y: flyoutCenter.y,
324
+ verticalAnchor: "middle",
325
+ angle: labelStyle.angle
326
+ });
325
327
  }
326
328
 
327
329
  getFlyoutProps(props, calculatedValues) {
328
330
  const { flyoutDimensions, flyoutStyle } = calculatedValues;
329
331
  const {
330
- x, y, dx, dy, datum, index, orientation, pointerLength, pointerWidth,
331
- cornerRadius, events, flyoutComponent
332
+ x,
333
+ y,
334
+ dx,
335
+ dy,
336
+ datum,
337
+ index,
338
+ orientation,
339
+ pointerLength,
340
+ pointerWidth,
341
+ cornerRadius,
342
+ events,
343
+ flyoutComponent
332
344
  } = props;
333
- return defaults(
334
- {},
335
- flyoutComponent.props,
336
- {
337
- x, y, dx, dy, datum, index, orientation, pointerLength, pointerWidth, cornerRadius, events,
338
- key: `${this.id}-tooltip-${index}`,
339
- width: flyoutDimensions.width,
340
- height: flyoutDimensions.height,
341
- style: flyoutStyle
342
- }
343
- );
345
+ return defaults({}, flyoutComponent.props, {
346
+ x,
347
+ y,
348
+ dx,
349
+ dy,
350
+ datum,
351
+ index,
352
+ orientation,
353
+ pointerLength,
354
+ pointerWidth,
355
+ cornerRadius,
356
+ events,
357
+ key: `${this.id}-tooltip-${index}`,
358
+ width: flyoutDimensions.width,
359
+ height: flyoutDimensions.height,
360
+ style: flyoutStyle
361
+ });
344
362
  }
345
363
 
346
364
  // Overridden in victory-core-native
347
365
  renderTooltip(props) {
348
366
  const evaluatedProps = this.getEvaluatedProps(props);
349
367
  const {
350
- flyoutComponent, labelComponent, groupComponent, active, renderInPortal
368
+ flyoutComponent,
369
+ labelComponent,
370
+ groupComponent,
371
+ active,
372
+ renderInPortal
351
373
  } = evaluatedProps;
352
374
  if (!active) {
353
375
  return renderInPortal ? <VictoryPortal>{null}</VictoryPortal> : null;
@@ -366,7 +388,7 @@ export default class VictoryTooltip extends React.Component {
366
388
  }
367
389
 
368
390
  render() {
369
- const props = Helpers.modifyProps((this.props), fallbackProps, "tooltip");
391
+ const props = Helpers.modifyProps(this.props, fallbackProps, "tooltip");
370
392
  return this.renderTooltip(props);
371
393
  }
372
394
  }