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