victory-tooltip 36.4.1 → 36.5.2
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/victory-tooltip.js +6038 -246
- package/dist/victory-tooltip.min.js +1 -1
- package/es/flyout.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +2 -1
- package/es/victory-tooltip.js +12 -16
- package/lib/flyout.js +2 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/victory-tooltip.js +11 -16
- package/package.json +4 -4
- package/src/flyout.js +3 -3
- package/src/index.d.ts +1 -1
- package/src/victory-tooltip.js +58 -58
package/lib/victory-tooltip.js
CHANGED
|
@@ -45,7 +45,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
45
45
|
|
|
46
46
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
47
47
|
|
|
48
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
48
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
49
49
|
|
|
50
50
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
51
51
|
|
|
@@ -55,9 +55,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
55
55
|
|
|
56
56
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
57
57
|
|
|
58
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
59
|
-
|
|
60
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
58
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
61
59
|
|
|
62
60
|
var fallbackProps = {
|
|
63
61
|
cornerRadius: 5,
|
|
@@ -550,12 +548,9 @@ var VictoryTooltip = /*#__PURE__*/function (_React$Component) {
|
|
|
550
548
|
}(_react.default.Component);
|
|
551
549
|
|
|
552
550
|
exports.default = VictoryTooltip;
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
_defineProperty(VictoryTooltip, "role", "tooltip");
|
|
557
|
-
|
|
558
|
-
_defineProperty(VictoryTooltip, "propTypes", {
|
|
551
|
+
VictoryTooltip.displayName = "VictoryTooltip";
|
|
552
|
+
VictoryTooltip.role = "tooltip";
|
|
553
|
+
VictoryTooltip.propTypes = {
|
|
559
554
|
activateData: _propTypes.default.bool,
|
|
560
555
|
active: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.func]),
|
|
561
556
|
activePoints: _propTypes.default.array,
|
|
@@ -607,17 +602,16 @@ _defineProperty(VictoryTooltip, "propTypes", {
|
|
|
607
602
|
width: _propTypes.default.number,
|
|
608
603
|
x: _propTypes.default.number,
|
|
609
604
|
y: _propTypes.default.number
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
_defineProperty(VictoryTooltip, "defaultProps", {
|
|
605
|
+
};
|
|
606
|
+
VictoryTooltip.defaultProps = {
|
|
613
607
|
active: false,
|
|
614
608
|
renderInPortal: true,
|
|
615
609
|
labelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
616
610
|
flyoutComponent: /*#__PURE__*/_react.default.createElement(_flyout.default, null),
|
|
617
611
|
groupComponent: /*#__PURE__*/_react.default.createElement("g", null)
|
|
618
|
-
}
|
|
612
|
+
};
|
|
619
613
|
|
|
620
|
-
|
|
614
|
+
VictoryTooltip.defaultEvents = function (props) {
|
|
621
615
|
var activate = props.activateData ? [{
|
|
622
616
|
target: "labels",
|
|
623
617
|
mutation: function () {
|
|
@@ -685,4 +679,5 @@ _defineProperty(VictoryTooltip, "defaultEvents", function (props) {
|
|
|
685
679
|
}
|
|
686
680
|
}
|
|
687
681
|
}];
|
|
688
|
-
}
|
|
682
|
+
};
|
|
683
|
+
//# sourceMappingURL=victory-tooltip.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-tooltip",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.5.2",
|
|
4
4
|
"description": "Tooltip Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"lodash": "^4.17.19",
|
|
23
23
|
"prop-types": "^15.8.1",
|
|
24
|
-
"victory-core": "^36.
|
|
24
|
+
"victory-core": "^36.5.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"react": "
|
|
27
|
+
"react": ">=16.6.0"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"version": "yarn run nps build-libs && nps build-dists"
|
|
31
31
|
},
|
|
32
32
|
"sideEffects": false,
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "def218e9749ecafc159ef458dd03a8b92e227666"
|
|
34
34
|
}
|
package/src/flyout.js
CHANGED
|
@@ -98,7 +98,7 @@ const Flyout = (props) => {
|
|
|
98
98
|
shapeRendering: props.shapeRendering,
|
|
99
99
|
role: props.role,
|
|
100
100
|
transform: props.transform,
|
|
101
|
-
clipPath: props.clipPath
|
|
101
|
+
clipPath: props.clipPath,
|
|
102
102
|
});
|
|
103
103
|
};
|
|
104
104
|
|
|
@@ -116,13 +116,13 @@ Flyout.propTypes = {
|
|
|
116
116
|
pointerWidth: PropTypes.number,
|
|
117
117
|
width: PropTypes.number,
|
|
118
118
|
x: PropTypes.number,
|
|
119
|
-
y: PropTypes.number
|
|
119
|
+
y: PropTypes.number,
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
Flyout.defaultProps = {
|
|
123
123
|
pathComponent: <Path />,
|
|
124
124
|
role: "presentation",
|
|
125
|
-
shapeRendering: "auto"
|
|
125
|
+
shapeRendering: "auto",
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
export default Flyout;
|
package/src/index.d.ts
CHANGED
package/src/victory-tooltip.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
LabelHelpers,
|
|
8
8
|
VictoryLabel,
|
|
9
9
|
VictoryTheme,
|
|
10
|
-
VictoryPortal
|
|
10
|
+
VictoryPortal,
|
|
11
11
|
} from "victory-core";
|
|
12
12
|
import Flyout from "./flyout";
|
|
13
13
|
import { assign, defaults, uniqueId, isPlainObject, orderBy } from "lodash";
|
|
@@ -15,7 +15,7 @@ import { assign, defaults, uniqueId, isPlainObject, orderBy } from "lodash";
|
|
|
15
15
|
const fallbackProps = {
|
|
16
16
|
cornerRadius: 5,
|
|
17
17
|
pointerLength: 10,
|
|
18
|
-
pointerWidth: 10
|
|
18
|
+
pointerWidth: 10,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export default class VictoryTooltip extends React.Component {
|
|
@@ -28,16 +28,16 @@ export default class VictoryTooltip extends React.Component {
|
|
|
28
28
|
angle: PropTypes.number,
|
|
29
29
|
center: PropTypes.shape({
|
|
30
30
|
x: CustomPropTypes.nonNegative,
|
|
31
|
-
y: CustomPropTypes.nonNegative
|
|
31
|
+
y: CustomPropTypes.nonNegative,
|
|
32
32
|
}),
|
|
33
33
|
centerOffset: PropTypes.shape({
|
|
34
34
|
x: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
35
|
-
y: PropTypes.oneOfType([PropTypes.number, PropTypes.func])
|
|
35
|
+
y: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
36
36
|
}),
|
|
37
37
|
constrainToVisibleArea: PropTypes.bool,
|
|
38
38
|
cornerRadius: PropTypes.oneOfType([
|
|
39
39
|
CustomPropTypes.nonNegative,
|
|
40
|
-
PropTypes.func
|
|
40
|
+
PropTypes.func,
|
|
41
41
|
]),
|
|
42
42
|
data: PropTypes.array,
|
|
43
43
|
datum: PropTypes.object,
|
|
@@ -47,7 +47,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
47
47
|
flyoutComponent: PropTypes.element,
|
|
48
48
|
flyoutHeight: PropTypes.oneOfType([
|
|
49
49
|
CustomPropTypes.nonNegative,
|
|
50
|
-
PropTypes.func
|
|
50
|
+
PropTypes.func,
|
|
51
51
|
]),
|
|
52
52
|
flyoutPadding: PropTypes.oneOfType([
|
|
53
53
|
PropTypes.func,
|
|
@@ -56,13 +56,13 @@ export default class VictoryTooltip extends React.Component {
|
|
|
56
56
|
top: PropTypes.number,
|
|
57
57
|
bottom: PropTypes.number,
|
|
58
58
|
left: PropTypes.number,
|
|
59
|
-
right: PropTypes.number
|
|
60
|
-
})
|
|
59
|
+
right: PropTypes.number,
|
|
60
|
+
}),
|
|
61
61
|
]),
|
|
62
62
|
flyoutStyle: PropTypes.object,
|
|
63
63
|
flyoutWidth: PropTypes.oneOfType([
|
|
64
64
|
CustomPropTypes.nonNegative,
|
|
65
|
-
PropTypes.func
|
|
65
|
+
PropTypes.func,
|
|
66
66
|
]),
|
|
67
67
|
groupComponent: PropTypes.element,
|
|
68
68
|
height: PropTypes.number,
|
|
@@ -72,37 +72,37 @@ export default class VictoryTooltip extends React.Component {
|
|
|
72
72
|
labelComponent: PropTypes.element,
|
|
73
73
|
orientation: PropTypes.oneOfType([
|
|
74
74
|
PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
75
|
-
PropTypes.func
|
|
75
|
+
PropTypes.func,
|
|
76
76
|
]),
|
|
77
77
|
pointerLength: PropTypes.oneOfType([
|
|
78
78
|
CustomPropTypes.nonNegative,
|
|
79
|
-
PropTypes.func
|
|
79
|
+
PropTypes.func,
|
|
80
80
|
]),
|
|
81
81
|
pointerOrientation: PropTypes.oneOfType([
|
|
82
82
|
PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
83
|
-
PropTypes.func
|
|
83
|
+
PropTypes.func,
|
|
84
84
|
]),
|
|
85
85
|
pointerWidth: PropTypes.oneOfType([
|
|
86
86
|
CustomPropTypes.nonNegative,
|
|
87
|
-
PropTypes.func
|
|
87
|
+
PropTypes.func,
|
|
88
88
|
]),
|
|
89
89
|
polar: PropTypes.bool,
|
|
90
90
|
renderInPortal: PropTypes.bool,
|
|
91
91
|
scale: PropTypes.shape({
|
|
92
92
|
x: CustomPropTypes.scale,
|
|
93
|
-
y: CustomPropTypes.scale
|
|
93
|
+
y: CustomPropTypes.scale,
|
|
94
94
|
}),
|
|
95
95
|
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
96
96
|
text: PropTypes.oneOfType([
|
|
97
97
|
PropTypes.string,
|
|
98
98
|
PropTypes.number,
|
|
99
99
|
PropTypes.func,
|
|
100
|
-
PropTypes.array
|
|
100
|
+
PropTypes.array,
|
|
101
101
|
]),
|
|
102
102
|
theme: PropTypes.object,
|
|
103
103
|
width: PropTypes.number,
|
|
104
104
|
x: PropTypes.number,
|
|
105
|
-
y: PropTypes.number
|
|
105
|
+
y: PropTypes.number,
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
static defaultProps = {
|
|
@@ -110,20 +110,20 @@ export default class VictoryTooltip extends React.Component {
|
|
|
110
110
|
renderInPortal: true,
|
|
111
111
|
labelComponent: <VictoryLabel />,
|
|
112
112
|
flyoutComponent: <Flyout />,
|
|
113
|
-
groupComponent: <g
|
|
113
|
+
groupComponent: <g />,
|
|
114
114
|
};
|
|
115
115
|
|
|
116
116
|
static defaultEvents = (props) => {
|
|
117
117
|
const activate = props.activateData
|
|
118
118
|
? [
|
|
119
119
|
{ target: "labels", mutation: () => ({ active: true }) },
|
|
120
|
-
{ target: "data", mutation: () => ({ active: true }) }
|
|
120
|
+
{ target: "data", mutation: () => ({ active: true }) },
|
|
121
121
|
]
|
|
122
122
|
: [{ target: "labels", mutation: () => ({ active: true }) }];
|
|
123
123
|
const deactivate = props.activateData
|
|
124
124
|
? [
|
|
125
125
|
{ target: "labels", mutation: () => ({ active: undefined }) },
|
|
126
|
-
{ target: "data", mutation: () => ({ active: undefined }) }
|
|
126
|
+
{ target: "data", mutation: () => ({ active: undefined }) },
|
|
127
127
|
]
|
|
128
128
|
: [{ target: "labels", mutation: () => ({ active: undefined }) }];
|
|
129
129
|
return [
|
|
@@ -135,9 +135,9 @@ export default class VictoryTooltip extends React.Component {
|
|
|
135
135
|
onTouchStart: () => activate,
|
|
136
136
|
onMouseOut: () => deactivate,
|
|
137
137
|
onBlur: () => deactivate,
|
|
138
|
-
onTouchEnd: () => deactivate
|
|
139
|
-
}
|
|
140
|
-
}
|
|
138
|
+
onTouchEnd: () => deactivate,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
141
|
];
|
|
142
142
|
};
|
|
143
143
|
|
|
@@ -203,7 +203,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
203
203
|
: Helpers.evaluateStyle(baseLabelStyle, props);
|
|
204
204
|
const flyoutStyle = Helpers.evaluateStyle(
|
|
205
205
|
baseFlyoutStyle,
|
|
206
|
-
assign({}, props, { style })
|
|
206
|
+
assign({}, props, { style }),
|
|
207
207
|
);
|
|
208
208
|
return { style, flyoutStyle };
|
|
209
209
|
}
|
|
@@ -214,33 +214,33 @@ export default class VictoryTooltip extends React.Component {
|
|
|
214
214
|
const active = Helpers.evaluateProp(props.active, props);
|
|
215
215
|
const text = Helpers.evaluateProp(
|
|
216
216
|
props.text,
|
|
217
|
-
assign({}, props, { active })
|
|
217
|
+
assign({}, props, { active }),
|
|
218
218
|
);
|
|
219
219
|
const { style, flyoutStyle } = this.getStyles(
|
|
220
|
-
assign({}, props, { active, text })
|
|
220
|
+
assign({}, props, { active, text }),
|
|
221
221
|
);
|
|
222
222
|
const orientation =
|
|
223
223
|
Helpers.evaluateProp(
|
|
224
224
|
props.orientation,
|
|
225
|
-
assign({}, props, { active, text, style, flyoutStyle })
|
|
225
|
+
assign({}, props, { active, text, style, flyoutStyle }),
|
|
226
226
|
) || this.getDefaultOrientation(props);
|
|
227
227
|
|
|
228
228
|
const padding =
|
|
229
229
|
Helpers.evaluateProp(
|
|
230
230
|
props.flyoutPadding,
|
|
231
|
-
assign({}, props, { active, text, style, flyoutStyle, orientation })
|
|
231
|
+
assign({}, props, { active, text, style, flyoutStyle, orientation }),
|
|
232
232
|
) || this.getLabelPadding(style);
|
|
233
233
|
|
|
234
234
|
const flyoutPadding = Helpers.getPadding({ padding });
|
|
235
235
|
|
|
236
236
|
const pointerWidth = Helpers.evaluateProp(
|
|
237
237
|
props.pointerWidth,
|
|
238
|
-
assign({}, props, { active, text, style, flyoutStyle, orientation })
|
|
238
|
+
assign({}, props, { active, text, style, flyoutStyle, orientation }),
|
|
239
239
|
);
|
|
240
240
|
|
|
241
241
|
const pointerLength = Helpers.evaluateProp(
|
|
242
242
|
props.pointerLength,
|
|
243
|
-
assign({}, props, { active, text, style, flyoutStyle, orientation })
|
|
243
|
+
assign({}, props, { active, text, style, flyoutStyle, orientation }),
|
|
244
244
|
);
|
|
245
245
|
const labelSize = TextSize.approximateTextSize(text, style);
|
|
246
246
|
|
|
@@ -253,9 +253,9 @@ export default class VictoryTooltip extends React.Component {
|
|
|
253
253
|
orientation,
|
|
254
254
|
flyoutPadding,
|
|
255
255
|
pointerWidth,
|
|
256
|
-
pointerLength
|
|
256
|
+
pointerLength,
|
|
257
257
|
}),
|
|
258
|
-
labelSize
|
|
258
|
+
labelSize,
|
|
259
259
|
);
|
|
260
260
|
|
|
261
261
|
const evaluatedProps = assign({}, props, {
|
|
@@ -268,7 +268,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
268
268
|
flyoutWidth,
|
|
269
269
|
flyoutPadding,
|
|
270
270
|
pointerWidth,
|
|
271
|
-
pointerLength
|
|
271
|
+
pointerLength,
|
|
272
272
|
});
|
|
273
273
|
|
|
274
274
|
const offsetX =
|
|
@@ -285,7 +285,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
285
285
|
centerOffset: { x: offsetX, y: offsetY },
|
|
286
286
|
dx: dx !== undefined ? Helpers.evaluateProp(dx, evaluatedProps) : 0,
|
|
287
287
|
dy: dy !== undefined ? Helpers.evaluateProp(dy, evaluatedProps) : 0,
|
|
288
|
-
cornerRadius: Helpers.evaluateProp(cornerRadius, evaluatedProps)
|
|
288
|
+
cornerRadius: Helpers.evaluateProp(cornerRadius, evaluatedProps),
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
|
|
@@ -301,7 +301,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
301
301
|
labelSize,
|
|
302
302
|
flyoutDimensions,
|
|
303
303
|
flyoutCenter,
|
|
304
|
-
transform
|
|
304
|
+
transform,
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
307
|
|
|
@@ -338,25 +338,25 @@ export default class VictoryTooltip extends React.Component {
|
|
|
338
338
|
const { width, height } = dimensions;
|
|
339
339
|
const extent = {
|
|
340
340
|
x: [0, props.width],
|
|
341
|
-
y: [0, props.height]
|
|
341
|
+
y: [0, props.height],
|
|
342
342
|
};
|
|
343
343
|
const flyoutExtent = {
|
|
344
344
|
x: [x - width / 2, x + width / 2],
|
|
345
|
-
y: [y - height / 2, y + height / 2]
|
|
345
|
+
y: [y - height / 2, y + height / 2],
|
|
346
346
|
};
|
|
347
347
|
const adjustments = {
|
|
348
348
|
x: [
|
|
349
349
|
flyoutExtent.x[0] < extent.x[0] ? extent.x[0] - flyoutExtent.x[0] : 0,
|
|
350
|
-
flyoutExtent.x[1] > extent.x[1] ? flyoutExtent.x[1] - extent.x[1] : 0
|
|
350
|
+
flyoutExtent.x[1] > extent.x[1] ? flyoutExtent.x[1] - extent.x[1] : 0,
|
|
351
351
|
],
|
|
352
352
|
y: [
|
|
353
353
|
flyoutExtent.y[0] < extent.y[0] ? extent.y[0] - flyoutExtent.y[0] : 0,
|
|
354
|
-
flyoutExtent.y[1] > extent.y[1] ? flyoutExtent.y[1] - extent.y[1] : 0
|
|
355
|
-
]
|
|
354
|
+
flyoutExtent.y[1] > extent.y[1] ? flyoutExtent.y[1] - extent.y[1] : 0,
|
|
355
|
+
],
|
|
356
356
|
};
|
|
357
357
|
return {
|
|
358
358
|
x: Math.round(x + adjustments.x[0] - adjustments.x[1]),
|
|
359
|
-
y: Math.round(y + adjustments.y[0] - adjustments.y[1])
|
|
359
|
+
y: Math.round(y + adjustments.y[0] - adjustments.y[1]),
|
|
360
360
|
};
|
|
361
361
|
}
|
|
362
362
|
|
|
@@ -370,7 +370,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
370
370
|
pointerLength,
|
|
371
371
|
orientation,
|
|
372
372
|
constrainToVisibleArea,
|
|
373
|
-
centerOffset
|
|
373
|
+
centerOffset,
|
|
374
374
|
} = props;
|
|
375
375
|
const { height, width } = dimensions;
|
|
376
376
|
const xSign = orientation === "left" ? -1 : 1;
|
|
@@ -383,7 +383,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
383
383
|
y:
|
|
384
384
|
orientation === "top" || orientation === "bottom"
|
|
385
385
|
? y - ySign * (pointerLength + height / 2 - ySign * dy)
|
|
386
|
-
: y + dy
|
|
386
|
+
: y + dy,
|
|
387
387
|
};
|
|
388
388
|
|
|
389
389
|
const center = {
|
|
@@ -394,12 +394,12 @@ export default class VictoryTooltip extends React.Component {
|
|
|
394
394
|
y:
|
|
395
395
|
isPlainObject(props.center) && props.center.y !== undefined
|
|
396
396
|
? props.center.y
|
|
397
|
-
: flyoutCenter.y
|
|
397
|
+
: flyoutCenter.y,
|
|
398
398
|
};
|
|
399
399
|
|
|
400
400
|
const centerWithOffset = {
|
|
401
401
|
x: center.x + centerOffset.x,
|
|
402
|
-
y: center.y + centerOffset.y
|
|
402
|
+
y: center.y + centerOffset.y,
|
|
403
403
|
};
|
|
404
404
|
|
|
405
405
|
return constrainToVisibleArea
|
|
@@ -424,7 +424,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
424
424
|
pointerWidth,
|
|
425
425
|
flyoutHeight,
|
|
426
426
|
flyoutWidth,
|
|
427
|
-
flyoutPadding
|
|
427
|
+
flyoutPadding,
|
|
428
428
|
} = props;
|
|
429
429
|
const cornerRadius = Helpers.evaluateProp(props.cornerRadius, props);
|
|
430
430
|
const getHeight = () => {
|
|
@@ -453,7 +453,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
453
453
|
: getHeight(props, labelSize, orientation),
|
|
454
454
|
flyoutWidth: flyoutWidth
|
|
455
455
|
? Helpers.evaluateProp(flyoutWidth, props)
|
|
456
|
-
: getWidth(props, labelSize, orientation)
|
|
456
|
+
: getWidth(props, labelSize, orientation),
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
459
|
|
|
@@ -484,7 +484,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
484
484
|
x: getLabelX() + (flyoutPadding.left - flyoutPadding.right) / 2,
|
|
485
485
|
y: flyoutCenter.y + (flyoutPadding.top - flyoutPadding.bottom) / 2,
|
|
486
486
|
verticalAnchor: "middle",
|
|
487
|
-
angle: style.angle
|
|
487
|
+
angle: style.angle,
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
|
|
@@ -493,20 +493,20 @@ export default class VictoryTooltip extends React.Component {
|
|
|
493
493
|
bottom: center.y + flyoutDimensions.height / 2,
|
|
494
494
|
top: center.y - flyoutDimensions.height / 2,
|
|
495
495
|
left: center.x - flyoutDimensions.width / 2,
|
|
496
|
-
right: center.x + flyoutDimensions.width / 2
|
|
496
|
+
right: center.x + flyoutDimensions.width / 2,
|
|
497
497
|
};
|
|
498
498
|
|
|
499
499
|
const gaps = [
|
|
500
500
|
{ side: "top", val: edges.top > point.y ? edges.top - point.y : -1 },
|
|
501
501
|
{
|
|
502
502
|
side: "bottom",
|
|
503
|
-
val: edges.bottom < point.y ? point.y - edges.bottom : -1
|
|
503
|
+
val: edges.bottom < point.y ? point.y - edges.bottom : -1,
|
|
504
504
|
},
|
|
505
505
|
{
|
|
506
506
|
side: "right",
|
|
507
|
-
val: edges.right < point.x ? point.x - edges.right : -1
|
|
507
|
+
val: edges.right < point.x ? point.x - edges.right : -1,
|
|
508
508
|
},
|
|
509
|
-
{ side: "left", val: edges.left > point.x ? edges.left - point.x : -1 }
|
|
509
|
+
{ side: "left", val: edges.left > point.x ? edges.left - point.x : -1 },
|
|
510
510
|
];
|
|
511
511
|
|
|
512
512
|
return orderBy(gaps, "val", "desc")[0].side;
|
|
@@ -526,11 +526,11 @@ export default class VictoryTooltip extends React.Component {
|
|
|
526
526
|
pointerWidth,
|
|
527
527
|
cornerRadius,
|
|
528
528
|
events,
|
|
529
|
-
flyoutComponent
|
|
529
|
+
flyoutComponent,
|
|
530
530
|
} = props;
|
|
531
531
|
const pointerOrientation = Helpers.evaluateProp(
|
|
532
532
|
props.pointerOrientation,
|
|
533
|
-
props
|
|
533
|
+
props,
|
|
534
534
|
);
|
|
535
535
|
return defaults({}, flyoutComponent.props, {
|
|
536
536
|
x,
|
|
@@ -551,7 +551,7 @@ export default class VictoryTooltip extends React.Component {
|
|
|
551
551
|
width: flyoutDimensions.width,
|
|
552
552
|
height: flyoutDimensions.height,
|
|
553
553
|
style: flyoutStyle,
|
|
554
|
-
center: flyoutCenter
|
|
554
|
+
center: flyoutCenter,
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
557
|
|
|
@@ -568,17 +568,17 @@ export default class VictoryTooltip extends React.Component {
|
|
|
568
568
|
const children = [
|
|
569
569
|
React.cloneElement(
|
|
570
570
|
flyoutComponent,
|
|
571
|
-
this.getFlyoutProps(evaluatedProps, calculatedValues)
|
|
571
|
+
this.getFlyoutProps(evaluatedProps, calculatedValues),
|
|
572
572
|
),
|
|
573
573
|
React.cloneElement(
|
|
574
574
|
labelComponent,
|
|
575
|
-
this.getLabelProps(evaluatedProps, calculatedValues)
|
|
576
|
-
)
|
|
575
|
+
this.getLabelProps(evaluatedProps, calculatedValues),
|
|
576
|
+
),
|
|
577
577
|
];
|
|
578
578
|
const tooltip = React.cloneElement(
|
|
579
579
|
groupComponent,
|
|
580
580
|
{ role: "presentation", transform: calculatedValues.transform },
|
|
581
|
-
children
|
|
581
|
+
children,
|
|
582
582
|
);
|
|
583
583
|
return renderInPortal ? <VictoryPortal>{tooltip}</VictoryPortal> : tooltip;
|
|
584
584
|
}
|