victory-box-plot 31.2.0 → 31.3.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/dist/victory-box-plot.js +14 -3
- package/dist/victory-box-plot.min.js +1 -1
- package/es/helper-methods.js +7 -2
- package/es/victory-box-plot.js +7 -1
- package/lib/helper-methods.js +7 -2
- package/lib/victory-box-plot.js +7 -1
- package/package.json +1 -1
- package/src/helper-methods.js +6 -2
- package/src/victory-box-plot.js +10 -1
package/es/helper-methods.js
CHANGED
|
@@ -340,6 +340,10 @@ var getText = function (props, type) {
|
|
|
340
340
|
return Array.isArray(labelProp) ? labelProp[index] : labelProp;
|
|
341
341
|
};
|
|
342
342
|
|
|
343
|
+
var getOrientation = function (labelOrientation, type) {
|
|
344
|
+
return typeof labelOrientation === "object" && labelOrientation[type] || labelOrientation;
|
|
345
|
+
};
|
|
346
|
+
|
|
343
347
|
var getLabelProps = function (props, text, type) {
|
|
344
348
|
var datum = props.datum,
|
|
345
349
|
positions = props.positions,
|
|
@@ -348,6 +352,7 @@ var getLabelProps = function (props, text, type) {
|
|
|
348
352
|
horizontal = props.horizontal,
|
|
349
353
|
labelOrientation = props.labelOrientation,
|
|
350
354
|
style = props.style;
|
|
355
|
+
var orientation = getOrientation(labelOrientation, type);
|
|
351
356
|
var namespace = "".concat(type, "Labels");
|
|
352
357
|
var labelStyle = style[namespace] || style.labels;
|
|
353
358
|
var defaultVerticalAnchor = horizontal ? "end" : "middle";
|
|
@@ -357,8 +362,8 @@ var getLabelProps = function (props, text, type) {
|
|
|
357
362
|
|
|
358
363
|
var getDefaultPosition = function (coord) {
|
|
359
364
|
var sign = {
|
|
360
|
-
x:
|
|
361
|
-
y:
|
|
365
|
+
x: orientation === "left" ? -1 : 1,
|
|
366
|
+
y: orientation === "top" ? -1 : 1
|
|
362
367
|
};
|
|
363
368
|
return positions[coord] + sign[coord] * width / 2 + sign[coord] * (labelStyle.padding || 0);
|
|
364
369
|
};
|
package/es/victory-box-plot.js
CHANGED
|
@@ -203,7 +203,13 @@ Object.defineProperty(VictoryBoxPlot, "propTypes", {
|
|
|
203
203
|
eventHandlers: PropTypes.object
|
|
204
204
|
})),
|
|
205
205
|
horizontal: PropTypes.bool,
|
|
206
|
-
labelOrientation: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
206
|
+
labelOrientation: PropTypes.oneOfType([PropTypes.oneOf(["top", "bottom", "left", "right"]), PropTypes.exact({
|
|
207
|
+
q1: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
208
|
+
q3: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
209
|
+
min: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
210
|
+
max: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
211
|
+
median: PropTypes.oneOf(["top", "bottom", "left", "right"])
|
|
212
|
+
})]),
|
|
207
213
|
labels: PropTypes.bool,
|
|
208
214
|
max: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
209
215
|
maxComponent: PropTypes.element,
|
package/lib/helper-methods.js
CHANGED
|
@@ -362,6 +362,10 @@ var getText = function (props, type) {
|
|
|
362
362
|
return Array.isArray(labelProp) ? labelProp[index] : labelProp;
|
|
363
363
|
};
|
|
364
364
|
|
|
365
|
+
var getOrientation = function (labelOrientation, type) {
|
|
366
|
+
return typeof labelOrientation === "object" && labelOrientation[type] || labelOrientation;
|
|
367
|
+
};
|
|
368
|
+
|
|
365
369
|
var getLabelProps = function (props, text, type) {
|
|
366
370
|
var datum = props.datum,
|
|
367
371
|
positions = props.positions,
|
|
@@ -370,6 +374,7 @@ var getLabelProps = function (props, text, type) {
|
|
|
370
374
|
horizontal = props.horizontal,
|
|
371
375
|
labelOrientation = props.labelOrientation,
|
|
372
376
|
style = props.style;
|
|
377
|
+
var orientation = getOrientation(labelOrientation, type);
|
|
373
378
|
var namespace = "".concat(type, "Labels");
|
|
374
379
|
var labelStyle = style[namespace] || style.labels;
|
|
375
380
|
var defaultVerticalAnchor = horizontal ? "end" : "middle";
|
|
@@ -379,8 +384,8 @@ var getLabelProps = function (props, text, type) {
|
|
|
379
384
|
|
|
380
385
|
var getDefaultPosition = function (coord) {
|
|
381
386
|
var sign = {
|
|
382
|
-
x:
|
|
383
|
-
y:
|
|
387
|
+
x: orientation === "left" ? -1 : 1,
|
|
388
|
+
y: orientation === "top" ? -1 : 1
|
|
384
389
|
};
|
|
385
390
|
return positions[coord] + sign[coord] * width / 2 + sign[coord] * (labelStyle.padding || 0);
|
|
386
391
|
};
|
package/lib/victory-box-plot.js
CHANGED
|
@@ -216,7 +216,13 @@ Object.defineProperty(VictoryBoxPlot, "propTypes", {
|
|
|
216
216
|
eventHandlers: _propTypes.default.object
|
|
217
217
|
})),
|
|
218
218
|
horizontal: _propTypes.default.bool,
|
|
219
|
-
labelOrientation: _propTypes.default.oneOf(["top", "bottom", "left", "right"]),
|
|
219
|
+
labelOrientation: _propTypes.default.oneOfType([_propTypes.default.oneOf(["top", "bottom", "left", "right"]), _propTypes.default.exact({
|
|
220
|
+
q1: _propTypes.default.oneOf(["top", "bottom", "left", "right"]),
|
|
221
|
+
q3: _propTypes.default.oneOf(["top", "bottom", "left", "right"]),
|
|
222
|
+
min: _propTypes.default.oneOf(["top", "bottom", "left", "right"]),
|
|
223
|
+
max: _propTypes.default.oneOf(["top", "bottom", "left", "right"]),
|
|
224
|
+
median: _propTypes.default.oneOf(["top", "bottom", "left", "right"])
|
|
225
|
+
})]),
|
|
220
226
|
labels: _propTypes.default.bool,
|
|
221
227
|
max: _propTypes.default.oneOfType([_propTypes.default.func, _victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer, _victoryCore.PropTypes.nonNegative]), _propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
222
228
|
maxComponent: _propTypes.default.element,
|
package/package.json
CHANGED
package/src/helper-methods.js
CHANGED
|
@@ -274,8 +274,12 @@ const getText = (props, type) => {
|
|
|
274
274
|
return Array.isArray(labelProp) ? labelProp[index] : labelProp;
|
|
275
275
|
};
|
|
276
276
|
|
|
277
|
+
const getOrientation = (labelOrientation, type) =>
|
|
278
|
+
(typeof labelOrientation === "object" && labelOrientation[type]) || labelOrientation;
|
|
279
|
+
|
|
277
280
|
const getLabelProps = (props, text, type) => {
|
|
278
281
|
const { datum, positions, index, boxWidth, horizontal, labelOrientation, style } = props;
|
|
282
|
+
const orientation = getOrientation(labelOrientation, type);
|
|
279
283
|
const namespace = `${type}Labels`;
|
|
280
284
|
const labelStyle = style[namespace] || style.labels;
|
|
281
285
|
const defaultVerticalAnchor = horizontal ? "end" : "middle";
|
|
@@ -285,8 +289,8 @@ const getLabelProps = (props, text, type) => {
|
|
|
285
289
|
|
|
286
290
|
const getDefaultPosition = (coord) => {
|
|
287
291
|
const sign = {
|
|
288
|
-
x:
|
|
289
|
-
y:
|
|
292
|
+
x: orientation === "left" ? -1 : 1,
|
|
293
|
+
y: orientation === "top" ? -1 : 1
|
|
290
294
|
};
|
|
291
295
|
return positions[coord] + (sign[coord] * width) / 2 + sign[coord] * (labelStyle.padding || 0);
|
|
292
296
|
};
|
package/src/victory-box-plot.js
CHANGED
|
@@ -82,7 +82,16 @@ class VictoryBoxPlot extends React.Component {
|
|
|
82
82
|
})
|
|
83
83
|
),
|
|
84
84
|
horizontal: PropTypes.bool,
|
|
85
|
-
labelOrientation: PropTypes.
|
|
85
|
+
labelOrientation: PropTypes.oneOfType([
|
|
86
|
+
PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
87
|
+
PropTypes.exact({
|
|
88
|
+
q1: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
89
|
+
q3: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
90
|
+
min: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
91
|
+
max: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
92
|
+
median: PropTypes.oneOf(["top", "bottom", "left", "right"])
|
|
93
|
+
})
|
|
94
|
+
]),
|
|
86
95
|
labels: PropTypes.bool,
|
|
87
96
|
max: PropTypes.oneOfType([
|
|
88
97
|
PropTypes.func,
|