victory-box-plot 36.9.2-next.0 → 36.9.2-next.3
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 +9 -3
- package/dist/victory-box-plot.js +5037 -4019
- package/dist/victory-box-plot.min.js +1 -1
- package/es/helper-methods.js +320 -269
- package/es/victory-box-plot.js +151 -88
- package/lib/helper-methods.js +334 -269
- package/lib/index.js +2 -0
- package/lib/victory-box-plot.js +158 -88
- package/package.json +4 -4
- package/src/helper-methods.tsx +2 -2
- package/src/victory-box-plot.tsx +9 -9
package/lib/index.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
|
|
6
7
|
var _victoryBoxPlot = require("./victory-box-plot");
|
|
8
|
+
|
|
7
9
|
Object.keys(_victoryBoxPlot).forEach(function (key) {
|
|
8
10
|
if (key === "default" || key === "__esModule") return;
|
|
9
11
|
if (key in exports && exports[key] === _victoryBoxPlot[key]) return;
|
package/lib/victory-box-plot.js
CHANGED
|
@@ -4,12 +4,48 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VictoryBoxPlot = void 0;
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
9
10
|
var _victoryCore = require("victory-core");
|
|
11
|
+
|
|
10
12
|
var _helperMethods = require("./helper-methods");
|
|
13
|
+
|
|
11
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
15
|
+
|
|
16
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
|
+
|
|
18
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
|
|
22
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
23
|
+
|
|
24
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
25
|
+
|
|
26
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
27
|
+
|
|
28
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
29
|
+
|
|
30
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
31
|
+
|
|
32
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
33
|
+
|
|
34
|
+
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); }
|
|
35
|
+
|
|
36
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
37
|
+
|
|
38
|
+
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); }; }
|
|
39
|
+
|
|
40
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
41
|
+
|
|
42
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
43
|
+
|
|
44
|
+
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; } }
|
|
45
|
+
|
|
46
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
|
+
|
|
48
|
+
var fallbackProps = {
|
|
13
49
|
width: 450,
|
|
14
50
|
height: 300,
|
|
15
51
|
padding: {
|
|
@@ -19,7 +55,7 @@ const fallbackProps = {
|
|
|
19
55
|
left: 20
|
|
20
56
|
}
|
|
21
57
|
};
|
|
22
|
-
|
|
58
|
+
var defaultData = [{
|
|
23
59
|
x: 1,
|
|
24
60
|
min: 5,
|
|
25
61
|
q1: 7,
|
|
@@ -34,7 +70,7 @@ const defaultData = [{
|
|
|
34
70
|
q3: 12,
|
|
35
71
|
max: 15
|
|
36
72
|
}];
|
|
37
|
-
|
|
73
|
+
var options = {
|
|
38
74
|
components: [{
|
|
39
75
|
name: "min"
|
|
40
76
|
}, {
|
|
@@ -61,90 +97,124 @@ const options = {
|
|
|
61
97
|
}]
|
|
62
98
|
};
|
|
63
99
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
class VictoryBoxPlotBase extends _react.default.Component {
|
|
67
|
-
static animationWhitelist = ["data", "domain", "height", "padding", "style", "width"];
|
|
68
|
-
static displayName = "VictoryBoxPlot";
|
|
69
|
-
static role = "boxplot";
|
|
70
|
-
static defaultTransitions = _victoryCore.DefaultTransitions.discreteTransitions();
|
|
71
|
-
static defaultProps = {
|
|
72
|
-
containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
|
|
73
|
-
data: defaultData,
|
|
74
|
-
dataComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Box, null),
|
|
75
|
-
groupComponent: /*#__PURE__*/_react.default.createElement("g", {
|
|
76
|
-
role: "presentation"
|
|
77
|
-
}),
|
|
78
|
-
maxComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Whisker, null),
|
|
79
|
-
maxLabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
80
|
-
medianComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.LineSegment, null),
|
|
81
|
-
medianLabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
82
|
-
minComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Whisker, null),
|
|
83
|
-
minLabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
84
|
-
q1Component: /*#__PURE__*/_react.default.createElement(_victoryCore.Box, null),
|
|
85
|
-
q1LabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
86
|
-
q3Component: /*#__PURE__*/_react.default.createElement(_victoryCore.Box, null),
|
|
87
|
-
q3LabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
88
|
-
samples: 50,
|
|
89
|
-
sortKey: "x",
|
|
90
|
-
sortOrder: "ascending",
|
|
91
|
-
standalone: true,
|
|
92
|
-
theme: _victoryCore.VictoryTheme.grayscale
|
|
93
|
-
};
|
|
94
|
-
static getDomain = _helperMethods.getDomain;
|
|
95
|
-
static getData = _helperMethods.getData;
|
|
96
|
-
static getBaseProps = props => (0, _helperMethods.getBaseProps)(props, fallbackProps);
|
|
97
|
-
static expectedComponents = ["maxComponent", "maxLabelComponent", "medianComponent", "medianLabelComponent", "minComponent", "minLabelComponent", "q1Component", "q1LabelComponent", "q3Component", "q3LabelComponent", "groupComponent", "containerComponent"];
|
|
98
|
-
renderBoxPlot(props) {
|
|
99
|
-
const types = ["q1", "q3", "max", "min", "median"];
|
|
100
|
-
const dataComponents = (0, _flatten2.default)(types.map(type => {
|
|
101
|
-
return this.dataKeys.reduce((validDataComponents, _key, index) => {
|
|
102
|
-
const baseComponent = props[`${type}Component`];
|
|
103
|
-
const componentProps = this.getComponentProps(baseComponent, type, index);
|
|
104
|
-
if (this.shouldRenderDatum(componentProps.datum)) {
|
|
105
|
-
validDataComponents.push( /*#__PURE__*/_react.default.cloneElement(baseComponent, componentProps));
|
|
106
|
-
}
|
|
107
|
-
return validDataComponents;
|
|
108
|
-
}, []);
|
|
109
|
-
}));
|
|
110
|
-
const labelComponents = (0, _flatten2.default)(types.map(type => {
|
|
111
|
-
const components = this.dataKeys.reduce((validComponents, _key, index) => {
|
|
112
|
-
const name = `${type}Labels`;
|
|
113
|
-
const baseComponent = props[`${type}LabelComponent`];
|
|
114
|
-
const labelProps = this.getComponentProps(baseComponent, name, index);
|
|
115
|
-
if (labelProps.text !== undefined && labelProps.text !== null) {
|
|
116
|
-
validComponents.push( /*#__PURE__*/_react.default.cloneElement(baseComponent, labelProps));
|
|
117
|
-
}
|
|
118
|
-
return validComponents;
|
|
119
|
-
}, []);
|
|
120
|
-
return components.filter(Boolean);
|
|
121
|
-
}));
|
|
122
|
-
const children = [...dataComponents, ...labelComponents];
|
|
123
|
-
return this.renderContainer(props.groupComponent, children);
|
|
124
|
-
}
|
|
100
|
+
var VictoryBoxPlotBase = /*#__PURE__*/function (_React$Component) {
|
|
101
|
+
_inherits(VictoryBoxPlotBase, _React$Component);
|
|
125
102
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const hasY = !_victoryCore.Helpers.isNil(datum._y);
|
|
133
|
-
const hasSummaryStatistics = !_victoryCore.Helpers.isNil(datum._min) && !_victoryCore.Helpers.isNil(datum._max) && !_victoryCore.Helpers.isNil(datum._median) && !_victoryCore.Helpers.isNil(datum._q1) && !_victoryCore.Helpers.isNil(datum._q3);
|
|
134
|
-
return hasSummaryStatistics && (this.props.horizontal ? hasY : hasX);
|
|
103
|
+
var _super = _createSuper(VictoryBoxPlotBase);
|
|
104
|
+
|
|
105
|
+
function VictoryBoxPlotBase() {
|
|
106
|
+
_classCallCheck(this, VictoryBoxPlotBase);
|
|
107
|
+
|
|
108
|
+
return _super.apply(this, arguments);
|
|
135
109
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
110
|
+
|
|
111
|
+
_createClass(VictoryBoxPlotBase, [{
|
|
112
|
+
key: "renderBoxPlot",
|
|
113
|
+
value: function renderBoxPlot(props) {
|
|
114
|
+
var _this = this;
|
|
115
|
+
|
|
116
|
+
var types = ["q1", "q3", "max", "min", "median"];
|
|
117
|
+
var dataComponents = types.map(function (type) {
|
|
118
|
+
return _this.dataKeys.reduce(function (validDataComponents, _key, index) {
|
|
119
|
+
var baseComponent = props["".concat(type, "Component")];
|
|
120
|
+
|
|
121
|
+
var componentProps = _this.getComponentProps(baseComponent, type, index);
|
|
122
|
+
|
|
123
|
+
if (_this.shouldRenderDatum(componentProps.datum)) {
|
|
124
|
+
validDataComponents.push( /*#__PURE__*/_react.default.cloneElement(baseComponent, componentProps));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return validDataComponents;
|
|
128
|
+
}, []);
|
|
129
|
+
}).flat();
|
|
130
|
+
var labelComponents = types.map(function (type) {
|
|
131
|
+
var components = _this.dataKeys.reduce(function (validComponents, _key, index) {
|
|
132
|
+
var name = "".concat(type, "Labels");
|
|
133
|
+
var baseComponent = props["".concat(type, "LabelComponent")];
|
|
134
|
+
|
|
135
|
+
var labelProps = _this.getComponentProps(baseComponent, name, index);
|
|
136
|
+
|
|
137
|
+
if (labelProps.text !== undefined && labelProps.text !== null) {
|
|
138
|
+
validComponents.push( /*#__PURE__*/_react.default.cloneElement(baseComponent, labelProps));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return validComponents;
|
|
142
|
+
}, []);
|
|
143
|
+
|
|
144
|
+
return components.filter(Boolean);
|
|
145
|
+
}).flat();
|
|
146
|
+
var children = [].concat(_toConsumableArray(dataComponents), _toConsumableArray(labelComponents));
|
|
147
|
+
return this.renderContainer(props.groupComponent, children);
|
|
148
|
+
} // Overridden in native versions
|
|
149
|
+
|
|
150
|
+
}, {
|
|
151
|
+
key: "shouldAnimate",
|
|
152
|
+
value: function shouldAnimate() {
|
|
153
|
+
return !!this.props.animate;
|
|
144
154
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
155
|
+
}, {
|
|
156
|
+
key: "shouldRenderDatum",
|
|
157
|
+
value: function shouldRenderDatum(datum) {
|
|
158
|
+
var hasX = !_victoryCore.Helpers.isNil(datum._x);
|
|
159
|
+
var hasY = !_victoryCore.Helpers.isNil(datum._y);
|
|
160
|
+
var hasSummaryStatistics = !_victoryCore.Helpers.isNil(datum._min) && !_victoryCore.Helpers.isNil(datum._max) && !_victoryCore.Helpers.isNil(datum._median) && !_victoryCore.Helpers.isNil(datum._q1) && !_victoryCore.Helpers.isNil(datum._q3);
|
|
161
|
+
return hasSummaryStatistics && (this.props.horizontal ? hasY : hasX);
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "render",
|
|
165
|
+
value: function render() {
|
|
166
|
+
var animationWhitelist = VictoryBoxPlot.animationWhitelist,
|
|
167
|
+
role = VictoryBoxPlot.role;
|
|
168
|
+
|
|
169
|
+
var props = _victoryCore.Helpers.modifyProps(this.props, fallbackProps, role);
|
|
170
|
+
|
|
171
|
+
if (this.shouldAnimate()) {
|
|
172
|
+
return this.animateComponent(props, animationWhitelist);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
var children = this.renderBoxPlot(props);
|
|
176
|
+
var component = props.standalone ? this.renderContainer(props.containerComponent, children) : children;
|
|
177
|
+
return _victoryCore.UserProps.withSafeUserProps(component, props);
|
|
178
|
+
}
|
|
179
|
+
}]);
|
|
180
|
+
|
|
181
|
+
return VictoryBoxPlotBase;
|
|
182
|
+
}(_react.default.Component);
|
|
183
|
+
|
|
184
|
+
VictoryBoxPlotBase.animationWhitelist = ["data", "domain", "height", "padding", "style", "width"];
|
|
185
|
+
VictoryBoxPlotBase.displayName = "VictoryBoxPlot";
|
|
186
|
+
VictoryBoxPlotBase.role = "boxplot";
|
|
187
|
+
VictoryBoxPlotBase.defaultTransitions = _victoryCore.DefaultTransitions.discreteTransitions();
|
|
188
|
+
VictoryBoxPlotBase.defaultProps = {
|
|
189
|
+
containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
|
|
190
|
+
data: defaultData,
|
|
191
|
+
dataComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Box, null),
|
|
192
|
+
groupComponent: /*#__PURE__*/_react.default.createElement("g", {
|
|
193
|
+
role: "presentation"
|
|
194
|
+
}),
|
|
195
|
+
maxComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Whisker, null),
|
|
196
|
+
maxLabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
197
|
+
medianComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.LineSegment, null),
|
|
198
|
+
medianLabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
199
|
+
minComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Whisker, null),
|
|
200
|
+
minLabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
201
|
+
q1Component: /*#__PURE__*/_react.default.createElement(_victoryCore.Box, null),
|
|
202
|
+
q1LabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
203
|
+
q3Component: /*#__PURE__*/_react.default.createElement(_victoryCore.Box, null),
|
|
204
|
+
q3LabelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
205
|
+
samples: 50,
|
|
206
|
+
sortKey: "x",
|
|
207
|
+
sortOrder: "ascending",
|
|
208
|
+
standalone: true,
|
|
209
|
+
theme: _victoryCore.VictoryTheme.grayscale
|
|
210
|
+
};
|
|
211
|
+
VictoryBoxPlotBase.getDomain = _helperMethods.getDomain;
|
|
212
|
+
VictoryBoxPlotBase.getData = _helperMethods.getData;
|
|
213
|
+
|
|
214
|
+
VictoryBoxPlotBase.getBaseProps = function (props) {
|
|
215
|
+
return (0, _helperMethods.getBaseProps)(props, fallbackProps);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
VictoryBoxPlotBase.expectedComponents = ["maxComponent", "maxLabelComponent", "medianComponent", "medianLabelComponent", "minComponent", "minLabelComponent", "q1Component", "q1LabelComponent", "q3Component", "q3LabelComponent", "groupComponent", "containerComponent"];
|
|
219
|
+
var VictoryBoxPlot = (0, _victoryCore.addEvents)(VictoryBoxPlotBase, options);
|
|
220
|
+
exports.VictoryBoxPlot = VictoryBoxPlot;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-box-plot",
|
|
3
|
-
"version": "36.9.2-next.
|
|
3
|
+
"version": "36.9.2-next.3",
|
|
4
4
|
"description": "Box Plot Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.19",
|
|
24
|
-
"victory-core": "^36.9.2-next.
|
|
25
|
-
"victory-vendor": "^36.9.2-next.
|
|
24
|
+
"victory-core": "^36.9.2-next.3",
|
|
25
|
+
"victory-vendor": "^36.9.2-next.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": ">=16.6.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"victory-chart": "36.9.2-next.
|
|
31
|
+
"victory-chart": "36.9.2-next.3"
|
|
32
32
|
},
|
|
33
33
|
"wireit": {
|
|
34
34
|
"### THESE WIREIT CONFIGS ARE GENERATED ####": {},
|
package/src/helper-methods.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { orderBy, defaults, uniq, groupBy
|
|
1
|
+
import { orderBy, defaults, uniq, groupBy } from "lodash";
|
|
2
2
|
import { Helpers, Scale, Domain, Data, Collection } from "victory-core";
|
|
3
3
|
import {
|
|
4
4
|
min as d3Min,
|
|
@@ -72,7 +72,7 @@ const processData = (data) => {
|
|
|
72
72
|
} else {
|
|
73
73
|
/* Group data by independent variable and generate summary statistics for each group */
|
|
74
74
|
const groupedData = groupBy(data, groupKey);
|
|
75
|
-
return keys(groupedData).map((key) => {
|
|
75
|
+
return Object.keys(groupedData).map((key) => {
|
|
76
76
|
const datum = groupedData[key];
|
|
77
77
|
const sortedData = orderBy(datum, sortKey);
|
|
78
78
|
return getSummaryStatistics(sortedData);
|
package/src/victory-box-plot.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { flatten } from "lodash";
|
|
3
2
|
import {
|
|
4
3
|
Helpers,
|
|
5
4
|
VictoryLabel,
|
|
@@ -182,8 +181,8 @@ class VictoryBoxPlotBase extends React.Component<VictoryBoxPlotProps> {
|
|
|
182
181
|
|
|
183
182
|
renderBoxPlot(props) {
|
|
184
183
|
const types = ["q1", "q3", "max", "min", "median"];
|
|
185
|
-
const dataComponents =
|
|
186
|
-
|
|
184
|
+
const dataComponents = types
|
|
185
|
+
.map((type) => {
|
|
187
186
|
return this.dataKeys.reduce((validDataComponents, _key, index) => {
|
|
188
187
|
const baseComponent = props[`${type}Component`];
|
|
189
188
|
const componentProps = this.getComponentProps(
|
|
@@ -198,11 +197,11 @@ class VictoryBoxPlotBase extends React.Component<VictoryBoxPlotProps> {
|
|
|
198
197
|
}
|
|
199
198
|
return validDataComponents;
|
|
200
199
|
}, [] as React.ReactElement[]);
|
|
201
|
-
})
|
|
202
|
-
|
|
200
|
+
})
|
|
201
|
+
.flat();
|
|
203
202
|
|
|
204
|
-
const labelComponents =
|
|
205
|
-
|
|
203
|
+
const labelComponents = types
|
|
204
|
+
.map((type) => {
|
|
206
205
|
const components = this.dataKeys.reduce(
|
|
207
206
|
(validComponents, _key, index) => {
|
|
208
207
|
const name = `${type}Labels`;
|
|
@@ -222,8 +221,9 @@ class VictoryBoxPlotBase extends React.Component<VictoryBoxPlotProps> {
|
|
|
222
221
|
[] as React.ReactElement[],
|
|
223
222
|
);
|
|
224
223
|
return components.filter(Boolean);
|
|
225
|
-
})
|
|
226
|
-
|
|
224
|
+
})
|
|
225
|
+
.flat();
|
|
226
|
+
|
|
227
227
|
const children = [...dataComponents, ...labelComponents];
|
|
228
228
|
return this.renderContainer(props.groupComponent, children);
|
|
229
229
|
}
|