victory-errorbar 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-errorbar.js +3279 -4341
- package/dist/victory-errorbar.min.js +1 -1
- package/es/error-bar.js +60 -55
- package/es/helper-methods.js +141 -152
- package/es/victory-errorbar.js +44 -83
- package/lib/error-bar.js +61 -65
- package/lib/helper-methods.js +141 -169
- package/lib/index.js +0 -4
- package/lib/victory-errorbar.js +44 -91
- package/package.json +2 -2
package/es/error-bar.js
CHANGED
|
@@ -1,51 +1,46 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
|
|
7
1
|
/* eslint-disable max-statements */
|
|
8
2
|
import React from "react";
|
|
9
3
|
import { Helpers, Line, UserProps } from "victory-core";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
const renderBorder = (props, error, type) => {
|
|
5
|
+
const vertical = type === "right" || type === "left";
|
|
6
|
+
return /*#__PURE__*/React.cloneElement(props.lineComponent, {
|
|
7
|
+
...props.events,
|
|
14
8
|
role: props.role,
|
|
15
9
|
shapeRendering: props.shapeRendering,
|
|
16
10
|
className: props.className,
|
|
17
11
|
style: props.style,
|
|
18
12
|
transform: props.transform,
|
|
19
|
-
key:
|
|
13
|
+
key: `${props.id}-border-${type}`,
|
|
20
14
|
x1: vertical ? error[type] : props.x - props.borderWidth,
|
|
21
15
|
x2: vertical ? error[type] : props.x + props.borderWidth,
|
|
22
16
|
y1: vertical ? props.y - props.borderWidth : error[type],
|
|
23
17
|
y2: vertical ? props.y + props.borderWidth : error[type],
|
|
24
|
-
"data-type":
|
|
25
|
-
})
|
|
18
|
+
"data-type": `border-${type}`
|
|
19
|
+
});
|
|
26
20
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
const renderCross = (props, error, type) => {
|
|
22
|
+
const vertical = type === "top" || type === "bottom";
|
|
23
|
+
return /*#__PURE__*/React.cloneElement(props.lineComponent, {
|
|
24
|
+
...props.events,
|
|
31
25
|
role: props.role,
|
|
32
26
|
shapeRendering: props.shapeRendering,
|
|
33
27
|
className: props.className,
|
|
34
28
|
style: props.style,
|
|
35
29
|
transform: props.transform,
|
|
36
|
-
key:
|
|
30
|
+
key: `${props.id}-cross-${type}`,
|
|
37
31
|
x1: props.x,
|
|
38
32
|
x2: vertical ? props.x : error[type],
|
|
39
33
|
y1: props.y,
|
|
40
34
|
y2: vertical ? error[type] : props.y,
|
|
41
|
-
"data-type":
|
|
42
|
-
})
|
|
35
|
+
"data-type": `cross-${type}`
|
|
36
|
+
});
|
|
43
37
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
const calculateError = props => {
|
|
39
|
+
const {
|
|
40
|
+
errorX,
|
|
41
|
+
errorY
|
|
42
|
+
} = props;
|
|
43
|
+
const settings = {
|
|
49
44
|
right: {
|
|
50
45
|
error: errorX,
|
|
51
46
|
errorIndex: 0
|
|
@@ -63,22 +58,20 @@ var calculateError = function (props) {
|
|
|
63
58
|
errorIndex: 0
|
|
64
59
|
}
|
|
65
60
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
const getError = direction => {
|
|
62
|
+
const {
|
|
63
|
+
error,
|
|
64
|
+
errorIndex
|
|
65
|
+
} = settings[direction];
|
|
71
66
|
return error ? error[errorIndex] : undefined;
|
|
72
67
|
};
|
|
73
|
-
|
|
74
|
-
var result = ["right", "left", "top", "bottom"].reduce(function (memo, dir) {
|
|
68
|
+
const result = ["right", "left", "top", "bottom"].reduce((memo, dir) => {
|
|
75
69
|
memo[dir] = getError(dir);
|
|
76
70
|
return memo;
|
|
77
71
|
}, {});
|
|
78
72
|
return result;
|
|
79
73
|
};
|
|
80
|
-
|
|
81
|
-
var evaluateProps = function (props) {
|
|
74
|
+
const evaluateProps = props => {
|
|
82
75
|
/**
|
|
83
76
|
* Potential evaluated props are:
|
|
84
77
|
* `ariaLabel`
|
|
@@ -86,36 +79,48 @@ var evaluateProps = function (props) {
|
|
|
86
79
|
* `style`
|
|
87
80
|
* `tabIndex`
|
|
88
81
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
82
|
+
const ariaLabel = Helpers.evaluateProp(props.ariaLabel, props);
|
|
83
|
+
const id = Helpers.evaluateProp(props.id, props);
|
|
84
|
+
const style = Helpers.evaluateStyle(Object.assign({
|
|
92
85
|
stroke: "black"
|
|
93
86
|
}, props.style), props);
|
|
94
|
-
|
|
87
|
+
const tabIndex = Helpers.evaluateProp(props.tabIndex, props);
|
|
95
88
|
return Object.assign({}, props, {
|
|
96
|
-
ariaLabel
|
|
97
|
-
id
|
|
98
|
-
style
|
|
99
|
-
tabIndex
|
|
89
|
+
ariaLabel,
|
|
90
|
+
id,
|
|
91
|
+
style,
|
|
92
|
+
tabIndex
|
|
100
93
|
});
|
|
101
94
|
};
|
|
102
95
|
|
|
103
|
-
|
|
96
|
+
// ErrorProps for calculateError
|
|
97
|
+
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
99
|
+
|
|
100
|
+
const defaultProps = {
|
|
104
101
|
groupComponent: /*#__PURE__*/React.createElement("g", null),
|
|
105
102
|
lineComponent: /*#__PURE__*/React.createElement(Line, null),
|
|
106
103
|
role: "presentation",
|
|
107
104
|
shapeRendering: "auto"
|
|
108
105
|
};
|
|
109
|
-
export
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
106
|
+
export const ErrorBar = initialProps => {
|
|
107
|
+
const props = evaluateProps({
|
|
108
|
+
...defaultProps,
|
|
109
|
+
...initialProps
|
|
110
|
+
});
|
|
111
|
+
const {
|
|
112
|
+
groupComponent
|
|
113
|
+
} = props;
|
|
114
|
+
const userProps = UserProps.getSafeUserProps(props);
|
|
115
|
+
const {
|
|
116
|
+
tabIndex,
|
|
117
|
+
ariaLabel
|
|
118
|
+
} = props;
|
|
119
|
+
const error = calculateError(props);
|
|
120
|
+
const children = [error.right ? renderBorder(props, error, "right") : null, error.left ? renderBorder(props, error, "left") : null, error.bottom ? renderBorder(props, error, "bottom") : null, error.top ? renderBorder(props, error, "top") : null, error.right ? renderCross(props, error, "right") : null, error.left ? renderCross(props, error, "left") : null, error.bottom ? renderCross(props, error, "bottom") : null, error.top ? renderCross(props, error, "top") : null].filter(Boolean);
|
|
121
|
+
return /*#__PURE__*/React.cloneElement(groupComponent, {
|
|
122
|
+
tabIndex,
|
|
123
|
+
"aria-label": ariaLabel,
|
|
124
|
+
...userProps
|
|
125
|
+
}, children);
|
|
121
126
|
};
|
package/es/helper-methods.js
CHANGED
|
@@ -1,235 +1,224 @@
|
|
|
1
1
|
import _assign from "lodash/assign";
|
|
2
2
|
import _defaults from "lodash/defaults";
|
|
3
3
|
import { Helpers, LabelHelpers, Scale, Domain, Data, Collection } from "victory-core";
|
|
4
|
-
|
|
5
|
-
var getErrors = function (props, datum, axis) {
|
|
4
|
+
const getErrors = (props, datum, axis) => {
|
|
6
5
|
/**
|
|
7
6
|
* check if it is asymmetric error or symmetric error, asymmetric error should be an array
|
|
8
7
|
* and the first value is the positive error, the second is the negative error
|
|
9
8
|
* @param {Boolean} isArray(errorX)
|
|
10
9
|
* @return {String or Array}
|
|
11
10
|
*/
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
const errorNames = {
|
|
13
13
|
x: "_errorX",
|
|
14
14
|
y: "_errorY"
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const errors = datum[errorNames[axis]];
|
|
18
17
|
if (errors === 0) {
|
|
19
18
|
return false;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return Array.isArray(errors) ? [errors[0] === 0 ? false : scale(errors[0] + datum["_".concat(axis)]), errors[1] === 0 ? false : scale(datum["_".concat(axis)] - errors[1])] : [scale(errors + datum["_".concat(axis)]), scale(datum["_".concat(axis)] - errors)];
|
|
20
|
+
const scale = props.scale[axis];
|
|
21
|
+
return Array.isArray(errors) ? [errors[0] === 0 ? false : scale(errors[0] + datum[`_${axis}`]), errors[1] === 0 ? false : scale(datum[`_${axis}`] - errors[1])] : [scale(errors + datum[`_${axis}`]), scale(datum[`_${axis}`] - errors)];
|
|
24
22
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var accessorTypes = ["x", "y", "errorX", "errorY"];
|
|
28
|
-
|
|
23
|
+
export const getData = props => {
|
|
24
|
+
const accessorTypes = ["x", "y", "errorX", "errorY"];
|
|
29
25
|
if (props.data) {
|
|
30
26
|
return Data.formatData(props.data, props, accessorTypes);
|
|
31
27
|
}
|
|
32
|
-
|
|
33
|
-
var generatedData = props.errorX || props.errorY ? Data.generateData(props) : [];
|
|
28
|
+
const generatedData = props.errorX || props.errorY ? Data.generateData(props) : [];
|
|
34
29
|
return Data.formatData(generatedData, props, accessorTypes);
|
|
35
30
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var dataset = getData(props);
|
|
41
|
-
|
|
31
|
+
const getDomainFromData = (props, axis) => {
|
|
32
|
+
const minDomain = Domain.getMinFromProps(props, axis);
|
|
33
|
+
const maxDomain = Domain.getMaxFromProps(props, axis);
|
|
34
|
+
const dataset = getData(props);
|
|
42
35
|
if (dataset.length < 1) {
|
|
43
36
|
return minDomain !== undefined && maxDomain !== undefined ? Domain.getDomainFromMinMax(minDomain, maxDomain) : undefined;
|
|
44
37
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var currentError = Array.isArray(datum[error]) ? datum[error][errorIndex] : datum[error];
|
|
54
|
-
var current = datum["_".concat(axis)] + sign * (currentError || 0);
|
|
38
|
+
const error = axis === "x" ? "_errorX" : "_errorY";
|
|
39
|
+
const reduceErrorData = type => {
|
|
40
|
+
const baseCondition = type === "min" ? Infinity : -Infinity;
|
|
41
|
+
const errorIndex = type === "min" ? 1 : 0;
|
|
42
|
+
const sign = type === "min" ? -1 : 1;
|
|
43
|
+
return dataset.reduce((memo, datum) => {
|
|
44
|
+
const currentError = Array.isArray(datum[error]) ? datum[error][errorIndex] : datum[error];
|
|
45
|
+
const current = datum[`_${axis}`] + sign * (currentError || 0);
|
|
55
46
|
return memo < current && type === "min" || memo > current && type === "max" ? memo : current;
|
|
56
47
|
}, baseCondition);
|
|
57
48
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var max = maxDomain !== undefined ? maxDomain : reduceErrorData("max");
|
|
49
|
+
const min = minDomain !== undefined ? minDomain : reduceErrorData("min");
|
|
50
|
+
const max = maxDomain !== undefined ? maxDomain : reduceErrorData("max");
|
|
61
51
|
return Domain.getDomainFromMinMax(min, max);
|
|
62
52
|
};
|
|
63
|
-
|
|
64
|
-
export var getDomain = function (props, axis) {
|
|
53
|
+
export const getDomain = (props, axis) => {
|
|
65
54
|
return Domain.createDomainFunction(getDomainFromData)(props, axis);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
var formatDataFromDomain = function (datum, domain) {
|
|
69
|
-
var minDomainX = Collection.getMinValue(domain.x);
|
|
70
|
-
var maxDomainX = Collection.getMaxValue(domain.x);
|
|
71
|
-
var minDomainY = Collection.getMinValue(domain.y);
|
|
72
|
-
var maxDomainY = Collection.getMaxValue(domain.y);
|
|
73
|
-
var _x = datum._x,
|
|
74
|
-
_y = datum._y; // if either x or y center point is outside of the domain, null the entire data point
|
|
55
|
+
};
|
|
75
56
|
|
|
57
|
+
// This method will edit or remove errorbar data points that fall outside of the desired domain
|
|
58
|
+
const formatDataFromDomain = (datum, domain) => {
|
|
59
|
+
const minDomainX = Collection.getMinValue(domain.x);
|
|
60
|
+
const maxDomainX = Collection.getMaxValue(domain.x);
|
|
61
|
+
const minDomainY = Collection.getMinValue(domain.y);
|
|
62
|
+
const maxDomainY = Collection.getMaxValue(domain.y);
|
|
63
|
+
let {
|
|
64
|
+
_x,
|
|
65
|
+
_y
|
|
66
|
+
} = datum;
|
|
67
|
+
|
|
68
|
+
// if either x or y center point is outside of the domain, null the entire data point
|
|
76
69
|
if (_x < minDomainX || _x > maxDomainX || _y < minDomainY || _y > maxDomainY) _x = _y = null;
|
|
77
70
|
return Object.assign({}, datum, {
|
|
78
|
-
_x
|
|
79
|
-
_y
|
|
71
|
+
_x,
|
|
72
|
+
_y
|
|
80
73
|
});
|
|
81
74
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var range = {
|
|
75
|
+
const getCalculatedValues = props => {
|
|
76
|
+
const defaultStyles = Helpers.getDefaultStyles(props, "errorbar");
|
|
77
|
+
const style = Helpers.getStyles(props.style, defaultStyles) || {};
|
|
78
|
+
const data = getData(props);
|
|
79
|
+
const range = {
|
|
88
80
|
x: Helpers.getRange(props, "x"),
|
|
89
81
|
y: Helpers.getRange(props, "y")
|
|
90
82
|
};
|
|
91
|
-
|
|
83
|
+
const domain = {
|
|
92
84
|
x: getDomain(props, "x"),
|
|
93
85
|
y: getDomain(props, "y")
|
|
94
86
|
};
|
|
95
|
-
|
|
87
|
+
const scale = {
|
|
96
88
|
x: Scale.getBaseScale(props, "x").domain(domain.x).range(props.horizontal ? range.y : range.x),
|
|
97
89
|
y: Scale.getBaseScale(props, "y").domain(domain.y).range(props.horizontal ? range.x : range.y)
|
|
98
90
|
};
|
|
99
|
-
|
|
91
|
+
const origin = props.polar ? props.origin || Helpers.getPolarOrigin(props) : undefined;
|
|
100
92
|
return {
|
|
101
|
-
domain
|
|
102
|
-
data
|
|
103
|
-
scale
|
|
104
|
-
style
|
|
105
|
-
origin
|
|
93
|
+
domain,
|
|
94
|
+
data,
|
|
95
|
+
scale,
|
|
96
|
+
style,
|
|
97
|
+
origin
|
|
106
98
|
};
|
|
107
99
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
100
|
+
const getLabelProps = (dataProps, text, style) => {
|
|
101
|
+
const {
|
|
102
|
+
x,
|
|
103
|
+
y,
|
|
104
|
+
index,
|
|
105
|
+
scale,
|
|
106
|
+
errorY,
|
|
107
|
+
errorX,
|
|
108
|
+
horizontal,
|
|
109
|
+
labelComponent,
|
|
110
|
+
theme,
|
|
111
|
+
disableInlineStyles
|
|
112
|
+
} = dataProps;
|
|
113
|
+
const getError = function (type) {
|
|
114
|
+
if (type === void 0) {
|
|
115
|
+
type = "x";
|
|
116
|
+
}
|
|
117
|
+
const baseError = type === "y" ? errorY : errorX;
|
|
118
|
+
const error = baseError && Array.isArray(baseError) ? baseError[0] : baseError;
|
|
125
119
|
return error || dataProps[type];
|
|
126
120
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var labelProps = {
|
|
121
|
+
const labelStyle = style.labels || {};
|
|
122
|
+
const padding = labelStyle.padding || 0;
|
|
123
|
+
const textAnchor = horizontal ? "start" : "middle";
|
|
124
|
+
const verticalAnchor = horizontal ? "middle" : "end";
|
|
125
|
+
const labelProps = {
|
|
133
126
|
style: labelStyle,
|
|
134
127
|
y: horizontal ? y : getError("y"),
|
|
135
128
|
x: horizontal ? getError("x") : x,
|
|
136
129
|
dy: horizontal ? 0 : -padding,
|
|
137
130
|
dx: horizontal ? padding : 0,
|
|
138
|
-
text
|
|
139
|
-
index
|
|
140
|
-
scale
|
|
131
|
+
text,
|
|
132
|
+
index,
|
|
133
|
+
scale,
|
|
141
134
|
datum: dataProps.datum,
|
|
142
135
|
data: dataProps.data,
|
|
143
136
|
textAnchor: labelStyle.textAnchor || textAnchor,
|
|
144
137
|
verticalAnchor: labelStyle.verticalAnchor || verticalAnchor,
|
|
145
138
|
angle: labelStyle.angle,
|
|
146
|
-
horizontal
|
|
147
|
-
disableInlineStyles
|
|
139
|
+
horizontal,
|
|
140
|
+
disableInlineStyles
|
|
148
141
|
};
|
|
149
|
-
|
|
150
142
|
if (!Helpers.isTooltip(labelComponent)) {
|
|
151
143
|
return labelProps;
|
|
152
144
|
}
|
|
153
|
-
|
|
154
|
-
var tooltipTheme = theme && theme.tooltip || {};
|
|
145
|
+
const tooltipTheme = theme && theme.tooltip || {};
|
|
155
146
|
return _defaults({}, labelProps, Helpers.omit(tooltipTheme, ["style"]));
|
|
156
147
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
148
|
+
export const getBaseProps = (initialProps, fallbackProps) => {
|
|
149
|
+
const modifiedProps = Helpers.modifyProps(initialProps, fallbackProps, "errorbar");
|
|
150
|
+
const props = Object.assign({}, modifiedProps, getCalculatedValues(modifiedProps));
|
|
151
|
+
const {
|
|
152
|
+
borderWidth,
|
|
153
|
+
data,
|
|
154
|
+
domain,
|
|
155
|
+
events,
|
|
156
|
+
groupComponent,
|
|
157
|
+
height,
|
|
158
|
+
horizontal,
|
|
159
|
+
labels,
|
|
160
|
+
name,
|
|
161
|
+
origin,
|
|
162
|
+
padding,
|
|
163
|
+
polar,
|
|
164
|
+
scale,
|
|
165
|
+
sharedEvents,
|
|
166
|
+
standalone,
|
|
167
|
+
style,
|
|
168
|
+
theme,
|
|
169
|
+
width,
|
|
170
|
+
disableInlineStyles
|
|
171
|
+
} = props;
|
|
172
|
+
const initialChildProps = {
|
|
181
173
|
parent: {
|
|
182
|
-
data
|
|
183
|
-
domain
|
|
184
|
-
height
|
|
185
|
-
horizontal
|
|
186
|
-
name
|
|
187
|
-
origin
|
|
188
|
-
padding
|
|
189
|
-
polar
|
|
190
|
-
scale
|
|
191
|
-
standalone
|
|
174
|
+
data,
|
|
175
|
+
domain,
|
|
176
|
+
height,
|
|
177
|
+
horizontal,
|
|
178
|
+
name,
|
|
179
|
+
origin,
|
|
180
|
+
padding,
|
|
181
|
+
polar,
|
|
182
|
+
scale,
|
|
183
|
+
standalone,
|
|
192
184
|
style: style.parent,
|
|
193
|
-
theme
|
|
194
|
-
width
|
|
185
|
+
theme,
|
|
186
|
+
width
|
|
195
187
|
}
|
|
196
188
|
};
|
|
197
|
-
return data.reduce(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
data: data,
|
|
189
|
+
return data.reduce((childProps, datum, index) => {
|
|
190
|
+
const eventKey = !Helpers.isNil(datum.eventKey) ? datum.eventKey : index;
|
|
191
|
+
const {
|
|
192
|
+
x,
|
|
193
|
+
y
|
|
194
|
+
} = Helpers.scalePoint(_assign({}, props, {
|
|
195
|
+
scale
|
|
196
|
+
}), datum);
|
|
197
|
+
const formattedDatum = formatDataFromDomain(datum, domain);
|
|
198
|
+
const errorX = getErrors(props, formattedDatum, "x");
|
|
199
|
+
const errorY = getErrors(props, formattedDatum, "y");
|
|
200
|
+
const dataProps = {
|
|
201
|
+
borderWidth,
|
|
202
|
+
data,
|
|
212
203
|
datum: formattedDatum,
|
|
213
204
|
errorX: horizontal ? errorY : errorX,
|
|
214
205
|
errorY: horizontal ? errorX : errorY,
|
|
215
|
-
groupComponent
|
|
216
|
-
horizontal
|
|
217
|
-
index
|
|
218
|
-
scale
|
|
206
|
+
groupComponent,
|
|
207
|
+
horizontal,
|
|
208
|
+
index,
|
|
209
|
+
scale,
|
|
219
210
|
style: disableInlineStyles ? {} : style.data,
|
|
220
|
-
x
|
|
221
|
-
y
|
|
222
|
-
disableInlineStyles
|
|
211
|
+
x,
|
|
212
|
+
y,
|
|
213
|
+
disableInlineStyles
|
|
223
214
|
};
|
|
224
215
|
childProps[eventKey] = {
|
|
225
216
|
data: dataProps
|
|
226
217
|
};
|
|
227
|
-
|
|
228
|
-
|
|
218
|
+
const text = LabelHelpers.getText(props, datum, index);
|
|
229
219
|
if (text !== undefined && text !== null || labels && (events || sharedEvents)) {
|
|
230
220
|
childProps[eventKey].labels = getLabelProps(Object.assign({}, props, dataProps), text, style);
|
|
231
221
|
}
|
|
232
|
-
|
|
233
222
|
return childProps;
|
|
234
223
|
}, initialChildProps);
|
|
235
224
|
};
|