victory-stack 36.5.3 → 36.6.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/CHANGELOG.md +33 -0
- package/dist/victory-stack.js +1977 -1806
- package/dist/victory-stack.min.js +1 -1
- package/es/helper-methods.d.ts +53 -0
- package/es/helper-methods.js +19 -17
- package/es/index.d.ts +2 -35
- package/es/index.js +1 -1
- package/es/victory-stack.d.ts +82 -0
- package/es/victory-stack.js +14 -15
- package/lib/helper-methods.d.ts +53 -0
- package/lib/helper-methods.js +19 -17
- package/lib/index.d.ts +2 -35
- package/lib/index.js +11 -8
- package/lib/victory-stack.d.ts +82 -0
- package/lib/victory-stack.js +16 -19
- package/package.json +266 -8
- package/src/{helper-methods.js → helper-methods.tsx} +12 -13
- package/src/index.ts +1 -0
- package/src/{victory-stack.js → victory-stack.tsx} +51 -21
- package/src/index.d.ts +0 -35
- package/src/index.js +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare function getCalculatedProps(props: any, childComponents: any): {
|
|
2
|
+
datasets: any;
|
|
3
|
+
categories: any;
|
|
4
|
+
range: any;
|
|
5
|
+
domain: {
|
|
6
|
+
x: any;
|
|
7
|
+
y: any;
|
|
8
|
+
};
|
|
9
|
+
horizontal: any;
|
|
10
|
+
scale: {
|
|
11
|
+
x: import("victory-core").D3Scale<any>;
|
|
12
|
+
y: import("victory-core").D3Scale<any>;
|
|
13
|
+
};
|
|
14
|
+
style: any;
|
|
15
|
+
colorScale: any;
|
|
16
|
+
role: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function useMemoizedProps(initialProps: any): {
|
|
19
|
+
datasets: any;
|
|
20
|
+
categories: any;
|
|
21
|
+
range: any;
|
|
22
|
+
domain: {
|
|
23
|
+
x: any;
|
|
24
|
+
y: any;
|
|
25
|
+
};
|
|
26
|
+
horizontal: any;
|
|
27
|
+
scale: {
|
|
28
|
+
x: import("victory-core").D3Scale<any>;
|
|
29
|
+
y: import("victory-core").D3Scale<any>;
|
|
30
|
+
};
|
|
31
|
+
style: any;
|
|
32
|
+
colorScale: any;
|
|
33
|
+
role: string;
|
|
34
|
+
};
|
|
35
|
+
export declare function getChildProps(props: any, calculatedProps: any): {
|
|
36
|
+
height: any;
|
|
37
|
+
width: any;
|
|
38
|
+
padding: {
|
|
39
|
+
top: any;
|
|
40
|
+
bottom: any;
|
|
41
|
+
left: any;
|
|
42
|
+
right: any;
|
|
43
|
+
};
|
|
44
|
+
standalone: boolean;
|
|
45
|
+
theme: any;
|
|
46
|
+
categories: any;
|
|
47
|
+
domain: any;
|
|
48
|
+
range: any;
|
|
49
|
+
scale: any;
|
|
50
|
+
horizontal: any;
|
|
51
|
+
};
|
|
52
|
+
export declare function getChildren(props: any, childComponents: any, calculatedProps: any): any;
|
|
53
|
+
//# sourceMappingURL=helper-methods.d.ts.map
|
package/es/helper-methods.js
CHANGED
|
@@ -39,7 +39,7 @@ function fillData(props, datasets) {
|
|
|
39
39
|
}, {});
|
|
40
40
|
|
|
41
41
|
var xKeys = _keys(xMap).map(function (k) {
|
|
42
|
-
return
|
|
42
|
+
return Number(k);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
var xArr = _orderBy(xKeys);
|
|
@@ -48,7 +48,7 @@ function fillData(props, datasets) {
|
|
|
48
48
|
var indexOffset = 0;
|
|
49
49
|
var isDate = dataset[0] && dataset[0]._x instanceof Date;
|
|
50
50
|
var filledInData = xArr.map(function (x, index) {
|
|
51
|
-
x =
|
|
51
|
+
x = Number(x);
|
|
52
52
|
var datum = dataset[index - indexOffset];
|
|
53
53
|
|
|
54
54
|
if (datum) {
|
|
@@ -56,18 +56,10 @@ function fillData(props, datasets) {
|
|
|
56
56
|
|
|
57
57
|
if (x1 === x) {
|
|
58
58
|
return datum;
|
|
59
|
-
} else {
|
|
60
|
-
indexOffset++;
|
|
61
|
-
var y = fillInMissingData ? 0 : null;
|
|
62
|
-
x = isDate ? new Date(x) : x;
|
|
63
|
-
return {
|
|
64
|
-
x: x,
|
|
65
|
-
y: y,
|
|
66
|
-
_x: x,
|
|
67
|
-
_y: y
|
|
68
|
-
};
|
|
69
59
|
}
|
|
70
|
-
|
|
60
|
+
|
|
61
|
+
indexOffset++;
|
|
62
|
+
|
|
71
63
|
var _y = fillInMissingData ? 0 : null;
|
|
72
64
|
|
|
73
65
|
x = isDate ? new Date(x) : x;
|
|
@@ -78,6 +70,15 @@ function fillData(props, datasets) {
|
|
|
78
70
|
_y: _y
|
|
79
71
|
};
|
|
80
72
|
}
|
|
73
|
+
|
|
74
|
+
var y = fillInMissingData ? 0 : null;
|
|
75
|
+
x = isDate ? new Date(x) : x;
|
|
76
|
+
return {
|
|
77
|
+
x: x,
|
|
78
|
+
y: y,
|
|
79
|
+
_x: x,
|
|
80
|
+
_y: y
|
|
81
|
+
};
|
|
81
82
|
});
|
|
82
83
|
return filledInData;
|
|
83
84
|
});
|
|
@@ -103,7 +104,7 @@ function getY0(datum, index, datasets) {
|
|
|
103
104
|
}, []);
|
|
104
105
|
var y0 = previousPoints.length && previousPoints.reduce(function (memo, value) {
|
|
105
106
|
var sameSign = y < 0 && value < 0 || y >= 0 && value >= 0;
|
|
106
|
-
return sameSign ?
|
|
107
|
+
return sameSign ? Number(value) + memo : memo;
|
|
107
108
|
}, firstDatasetBaseline[group] || 0);
|
|
108
109
|
return previousPoints.some(function (point) {
|
|
109
110
|
return point instanceof Date;
|
|
@@ -118,8 +119,8 @@ function addLayoutData(props, datasets, index) {
|
|
|
118
119
|
var yOffset = getY0(datum, index, datasets) || 0;
|
|
119
120
|
return _assign({}, datum, {
|
|
120
121
|
_y0: !(datum._y instanceof Date) ? yOffset : yOffset ? new Date(yOffset) : datum._y,
|
|
121
|
-
_y1: datum._y === null ? null : datum._y instanceof Date ? new Date(
|
|
122
|
-
_x1: datum._x === null ? null : datum._x instanceof Date ? new Date(
|
|
122
|
+
_y1: datum._y === null ? null : datum._y instanceof Date ? new Date(Number(datum._y) + Number(yOffset)) : datum._y + yOffset,
|
|
123
|
+
_x1: datum._x === null ? null : datum._x instanceof Date ? new Date(Number(datum._x) + Number(xOffset)) : datum._x + xOffset
|
|
123
124
|
});
|
|
124
125
|
});
|
|
125
126
|
}
|
|
@@ -190,7 +191,8 @@ export function getCalculatedProps(props, childComponents) {
|
|
|
190
191
|
|
|
191
192
|
var withoutSharedEvents = function (props) {
|
|
192
193
|
var children = props.children;
|
|
193
|
-
var modifiedChildren = React.Children.toArray(children).map(function (
|
|
194
|
+
var modifiedChildren = React.Children.toArray(children).map(function (_child) {
|
|
195
|
+
var child = _child;
|
|
194
196
|
return _objectSpread(_objectSpread({}, child), {}, {
|
|
195
197
|
props: Helpers.omit(child.props, ["sharedEvents"])
|
|
196
198
|
});
|
package/es/index.d.ts
CHANGED
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
CategoryPropType,
|
|
4
|
-
ColorScalePropType,
|
|
5
|
-
DomainPropType,
|
|
6
|
-
EventPropTypeInterface,
|
|
7
|
-
StringOrNumberOrCallback,
|
|
8
|
-
VictoryCommonProps,
|
|
9
|
-
VictoryLabelableProps,
|
|
10
|
-
VictoryMultiLabelableProps,
|
|
11
|
-
VictoryStyleInterface,
|
|
12
|
-
} from "victory-core";
|
|
13
|
-
|
|
14
|
-
export type VictoryStackTTargetType = "data" | "labels" | "parent";
|
|
15
|
-
|
|
16
|
-
export interface VictoryStackProps
|
|
17
|
-
extends VictoryCommonProps,
|
|
18
|
-
VictoryLabelableProps,
|
|
19
|
-
VictoryMultiLabelableProps {
|
|
20
|
-
bins?: number | number[] | Date[];
|
|
21
|
-
categories?: CategoryPropType;
|
|
22
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
23
|
-
colorScale?: ColorScalePropType;
|
|
24
|
-
domain?: DomainPropType;
|
|
25
|
-
events?: EventPropTypeInterface<
|
|
26
|
-
VictoryStackTTargetType,
|
|
27
|
-
StringOrNumberOrCallback
|
|
28
|
-
>[];
|
|
29
|
-
eventKey?: StringOrNumberOrCallback;
|
|
30
|
-
fillInMissingData?: boolean;
|
|
31
|
-
style?: VictoryStyleInterface;
|
|
32
|
-
xOffset?: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class VictoryStack extends React.Component<VictoryStackProps, any> {}
|
|
1
|
+
export * from "./victory-stack";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
package/es/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./victory-stack";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CategoryPropType, ColorScalePropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryLabelableProps, VictoryMultiLabelableProps, VictoryStyleInterface, VictoryComponentConfiguration } from "victory-core";
|
|
4
|
+
export declare type VictoryStackTTargetType = "data" | "labels" | "parent";
|
|
5
|
+
export interface VictoryStackProps extends VictoryCommonProps, VictoryLabelableProps, VictoryMultiLabelableProps {
|
|
6
|
+
bins?: number | number[] | Date[];
|
|
7
|
+
categories?: CategoryPropType;
|
|
8
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
9
|
+
colorScale?: ColorScalePropType;
|
|
10
|
+
domain?: DomainPropType;
|
|
11
|
+
events?: EventPropTypeInterface<VictoryStackTTargetType, StringOrNumberOrCallback>[];
|
|
12
|
+
eventKey?: StringOrNumberOrCallback;
|
|
13
|
+
fillInMissingData?: boolean;
|
|
14
|
+
style?: VictoryStyleInterface;
|
|
15
|
+
xOffset?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const VictoryStack: React.NamedExoticComponent<any> & {
|
|
18
|
+
readonly type: {
|
|
19
|
+
(initialProps: any): JSX.Element;
|
|
20
|
+
propTypes: {
|
|
21
|
+
bins: PropTypes.Requireable<number | (number | Date | null | undefined)[]>;
|
|
22
|
+
categories: PropTypes.Requireable<(string | null | undefined)[] | PropTypes.InferProps<{
|
|
23
|
+
x: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
24
|
+
y: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
25
|
+
}>>;
|
|
26
|
+
children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
27
|
+
colorScale: PropTypes.Requireable<string | (string | null | undefined)[]>;
|
|
28
|
+
fillInMissingData: PropTypes.Requireable<boolean>;
|
|
29
|
+
horizontal: PropTypes.Requireable<boolean>;
|
|
30
|
+
labelComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
31
|
+
labels: PropTypes.Requireable<any[] | ((...args: any[]) => any)>;
|
|
32
|
+
style: PropTypes.Requireable<PropTypes.InferProps<{
|
|
33
|
+
parent: PropTypes.Requireable<object>;
|
|
34
|
+
data: PropTypes.Requireable<object>;
|
|
35
|
+
labels: PropTypes.Requireable<object>;
|
|
36
|
+
}>>;
|
|
37
|
+
xOffset: PropTypes.Requireable<number>;
|
|
38
|
+
theme?: React.Validator<import("victory-core").VictoryThemeDefinition | null | undefined> | undefined;
|
|
39
|
+
animate?: React.Validator<boolean | import("victory-core").AnimatePropTypeInterface | null | undefined> | undefined;
|
|
40
|
+
containerComponent?: React.Validator<React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined> | undefined;
|
|
41
|
+
domainPadding?: React.Validator<import("victory-core").ForAxes<import("victory-core").PaddingType> | null | undefined> | undefined;
|
|
42
|
+
externalEventMutations?: React.Validator<import("victory-core").EventCallbackInterface<string | string[], import("victory-core").StringOrNumberOrList>[] | null | undefined> | undefined;
|
|
43
|
+
groupComponent?: React.Validator<React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined> | undefined;
|
|
44
|
+
height?: React.Validator<number | null | undefined> | undefined;
|
|
45
|
+
maxDomain?: React.Validator<number | {
|
|
46
|
+
x?: number | undefined;
|
|
47
|
+
y?: number | undefined;
|
|
48
|
+
} | null | undefined> | undefined;
|
|
49
|
+
minDomain?: React.Validator<number | {
|
|
50
|
+
x?: number | undefined;
|
|
51
|
+
y?: number | undefined;
|
|
52
|
+
} | null | undefined> | undefined;
|
|
53
|
+
name?: React.Validator<string | null | undefined> | undefined;
|
|
54
|
+
origin?: React.Validator<import("victory-core").OriginType | null | undefined> | undefined;
|
|
55
|
+
padding?: React.Validator<import("victory-core").PaddingProps | null | undefined> | undefined;
|
|
56
|
+
polar?: React.Validator<boolean | null | undefined> | undefined;
|
|
57
|
+
range?: React.Validator<import("victory-core").ForAxes<import("victory-core").RangeTuple> | null | undefined> | undefined;
|
|
58
|
+
scale?: React.Validator<import("victory-core").D3Scale<any> | import("victory-core").ScaleName | {
|
|
59
|
+
x?: import("victory-core").D3Scale<any> | import("victory-core").ScaleName | undefined;
|
|
60
|
+
y?: import("victory-core").D3Scale<any> | import("victory-core").ScaleName | undefined;
|
|
61
|
+
} | null | undefined> | undefined;
|
|
62
|
+
sharedEvents?: React.Validator<{
|
|
63
|
+
events: any[];
|
|
64
|
+
getEventState: Function;
|
|
65
|
+
} | null | undefined> | undefined;
|
|
66
|
+
singleQuadrantDomainPadding?: React.Validator<boolean | {
|
|
67
|
+
x?: boolean | undefined;
|
|
68
|
+
y?: boolean | undefined;
|
|
69
|
+
} | null | undefined> | undefined;
|
|
70
|
+
standalone?: React.Validator<boolean | null | undefined> | undefined;
|
|
71
|
+
width?: React.Validator<number | null | undefined> | undefined;
|
|
72
|
+
};
|
|
73
|
+
defaultProps: {
|
|
74
|
+
containerComponent: JSX.Element;
|
|
75
|
+
groupComponent: JSX.Element;
|
|
76
|
+
standalone: boolean;
|
|
77
|
+
theme: import("victory-core").VictoryThemeDefinition;
|
|
78
|
+
fillInMissingData: boolean;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
} & VictoryComponentConfiguration<VictoryStackProps>;
|
|
82
|
+
//# sourceMappingURL=victory-stack.d.ts.map
|
package/es/victory-stack.js
CHANGED
|
@@ -20,9 +20,9 @@ var fallbackProps = {
|
|
|
20
20
|
padding: 50
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var VictoryStackBase = function (initialProps) {
|
|
24
24
|
// eslint-disable-next-line no-use-before-define
|
|
25
|
-
var role =
|
|
25
|
+
var role = VictoryStack.role;
|
|
26
26
|
|
|
27
27
|
var _Hooks$useAnimationSt = Hooks.useAnimationState(),
|
|
28
28
|
setAnimationState = _Hooks$useAnimationSt.setAnimationState,
|
|
@@ -46,13 +46,12 @@ var VictoryStack = function (initialProps) {
|
|
|
46
46
|
var calculatedProps = useMemoizedProps(modifiedProps);
|
|
47
47
|
var domain = calculatedProps.domain,
|
|
48
48
|
scale = calculatedProps.scale,
|
|
49
|
-
style = calculatedProps.style
|
|
50
|
-
origin = calculatedProps.origin;
|
|
49
|
+
style = calculatedProps.style;
|
|
51
50
|
var newChildren = React.useMemo(function () {
|
|
52
51
|
var children = getChildren(props, childComponents, calculatedProps);
|
|
53
52
|
var orderedChildren = children.map(function (child, index) {
|
|
54
53
|
var childProps = _assign({
|
|
55
|
-
animate: getAnimationProps(props, child, index
|
|
54
|
+
animate: getAnimationProps(props, child, index)
|
|
56
55
|
}, child.props);
|
|
57
56
|
|
|
58
57
|
return /*#__PURE__*/React.cloneElement(child, childProps);
|
|
@@ -77,13 +76,12 @@ var VictoryStack = function (initialProps) {
|
|
|
77
76
|
style: style.parent,
|
|
78
77
|
horizontal: horizontal,
|
|
79
78
|
polar: polar,
|
|
80
|
-
origin: origin,
|
|
81
79
|
name: name
|
|
82
80
|
};
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
return {};
|
|
86
|
-
}, [standalone, domain, scale, width, height, theme, style, horizontal, polar,
|
|
84
|
+
}, [standalone, domain, scale, width, height, theme, style, horizontal, polar, name]);
|
|
87
85
|
var userProps = React.useMemo(function () {
|
|
88
86
|
return UserProps.getSafeUserProps(initialProps);
|
|
89
87
|
}, [initialProps]);
|
|
@@ -121,7 +119,7 @@ var VictoryStack = function (initialProps) {
|
|
|
121
119
|
return /*#__PURE__*/React.cloneElement(container, container.props, newChildren);
|
|
122
120
|
};
|
|
123
121
|
|
|
124
|
-
|
|
122
|
+
VictoryStackBase.propTypes = _objectSpread(_objectSpread({}, CommonProps.baseProps), {}, {
|
|
125
123
|
bins: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([CustomPropTypes.nonNegative, PropTypes.instanceOf(Date)])), CustomPropTypes.nonNegative]),
|
|
126
124
|
categories: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.shape({
|
|
127
125
|
x: PropTypes.arrayOf(PropTypes.string),
|
|
@@ -140,17 +138,18 @@ VictoryStack.propTypes = _objectSpread(_objectSpread({}, CommonProps.baseProps),
|
|
|
140
138
|
}),
|
|
141
139
|
xOffset: PropTypes.number
|
|
142
140
|
});
|
|
143
|
-
|
|
141
|
+
VictoryStackBase.defaultProps = {
|
|
144
142
|
containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
|
|
145
143
|
groupComponent: /*#__PURE__*/React.createElement("g", null),
|
|
146
144
|
standalone: true,
|
|
147
145
|
theme: VictoryTheme.grayscale,
|
|
148
146
|
fillInMissingData: true
|
|
149
147
|
};
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
export
|
|
148
|
+
var componentConfig = {
|
|
149
|
+
role: "stack",
|
|
150
|
+
expectedComponents: ["groupComponent", "containerComponent", "labelComponent"],
|
|
151
|
+
getChildren: getChildren
|
|
152
|
+
};
|
|
153
|
+
export var VictoryStack = Object.assign( /*#__PURE__*/React.memo(VictoryStackBase, isEqual), componentConfig);
|
|
154
|
+
VictoryStack.displayName = "VictoryStack";
|
|
156
155
|
//# sourceMappingURL=victory-stack.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare function getCalculatedProps(props: any, childComponents: any): {
|
|
2
|
+
datasets: any;
|
|
3
|
+
categories: any;
|
|
4
|
+
range: any;
|
|
5
|
+
domain: {
|
|
6
|
+
x: any;
|
|
7
|
+
y: any;
|
|
8
|
+
};
|
|
9
|
+
horizontal: any;
|
|
10
|
+
scale: {
|
|
11
|
+
x: import("victory-core").D3Scale<any>;
|
|
12
|
+
y: import("victory-core").D3Scale<any>;
|
|
13
|
+
};
|
|
14
|
+
style: any;
|
|
15
|
+
colorScale: any;
|
|
16
|
+
role: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function useMemoizedProps(initialProps: any): {
|
|
19
|
+
datasets: any;
|
|
20
|
+
categories: any;
|
|
21
|
+
range: any;
|
|
22
|
+
domain: {
|
|
23
|
+
x: any;
|
|
24
|
+
y: any;
|
|
25
|
+
};
|
|
26
|
+
horizontal: any;
|
|
27
|
+
scale: {
|
|
28
|
+
x: import("victory-core").D3Scale<any>;
|
|
29
|
+
y: import("victory-core").D3Scale<any>;
|
|
30
|
+
};
|
|
31
|
+
style: any;
|
|
32
|
+
colorScale: any;
|
|
33
|
+
role: string;
|
|
34
|
+
};
|
|
35
|
+
export declare function getChildProps(props: any, calculatedProps: any): {
|
|
36
|
+
height: any;
|
|
37
|
+
width: any;
|
|
38
|
+
padding: {
|
|
39
|
+
top: any;
|
|
40
|
+
bottom: any;
|
|
41
|
+
left: any;
|
|
42
|
+
right: any;
|
|
43
|
+
};
|
|
44
|
+
standalone: boolean;
|
|
45
|
+
theme: any;
|
|
46
|
+
categories: any;
|
|
47
|
+
domain: any;
|
|
48
|
+
range: any;
|
|
49
|
+
scale: any;
|
|
50
|
+
horizontal: any;
|
|
51
|
+
};
|
|
52
|
+
export declare function getChildren(props: any, childComponents: any, calculatedProps: any): any;
|
|
53
|
+
//# sourceMappingURL=helper-methods.d.ts.map
|
package/lib/helper-methods.js
CHANGED
|
@@ -55,14 +55,14 @@ function fillData(props, datasets) {
|
|
|
55
55
|
return prev;
|
|
56
56
|
}, {});
|
|
57
57
|
var xKeys = (0, _keys2.default)(xMap).map(function (k) {
|
|
58
|
-
return
|
|
58
|
+
return Number(k);
|
|
59
59
|
});
|
|
60
60
|
var xArr = (0, _orderBy2.default)(xKeys);
|
|
61
61
|
return datasets.map(function (dataset) {
|
|
62
62
|
var indexOffset = 0;
|
|
63
63
|
var isDate = dataset[0] && dataset[0]._x instanceof Date;
|
|
64
64
|
var filledInData = xArr.map(function (x, index) {
|
|
65
|
-
x =
|
|
65
|
+
x = Number(x);
|
|
66
66
|
var datum = dataset[index - indexOffset];
|
|
67
67
|
|
|
68
68
|
if (datum) {
|
|
@@ -70,18 +70,10 @@ function fillData(props, datasets) {
|
|
|
70
70
|
|
|
71
71
|
if (x1 === x) {
|
|
72
72
|
return datum;
|
|
73
|
-
} else {
|
|
74
|
-
indexOffset++;
|
|
75
|
-
var y = fillInMissingData ? 0 : null;
|
|
76
|
-
x = isDate ? new Date(x) : x;
|
|
77
|
-
return {
|
|
78
|
-
x: x,
|
|
79
|
-
y: y,
|
|
80
|
-
_x: x,
|
|
81
|
-
_y: y
|
|
82
|
-
};
|
|
83
73
|
}
|
|
84
|
-
|
|
74
|
+
|
|
75
|
+
indexOffset++;
|
|
76
|
+
|
|
85
77
|
var _y = fillInMissingData ? 0 : null;
|
|
86
78
|
|
|
87
79
|
x = isDate ? new Date(x) : x;
|
|
@@ -92,6 +84,15 @@ function fillData(props, datasets) {
|
|
|
92
84
|
_y: _y
|
|
93
85
|
};
|
|
94
86
|
}
|
|
87
|
+
|
|
88
|
+
var y = fillInMissingData ? 0 : null;
|
|
89
|
+
x = isDate ? new Date(x) : x;
|
|
90
|
+
return {
|
|
91
|
+
x: x,
|
|
92
|
+
y: y,
|
|
93
|
+
_x: x,
|
|
94
|
+
_y: y
|
|
95
|
+
};
|
|
95
96
|
});
|
|
96
97
|
return filledInData;
|
|
97
98
|
});
|
|
@@ -117,7 +118,7 @@ function getY0(datum, index, datasets) {
|
|
|
117
118
|
}, []);
|
|
118
119
|
var y0 = previousPoints.length && previousPoints.reduce(function (memo, value) {
|
|
119
120
|
var sameSign = y < 0 && value < 0 || y >= 0 && value >= 0;
|
|
120
|
-
return sameSign ?
|
|
121
|
+
return sameSign ? Number(value) + memo : memo;
|
|
121
122
|
}, firstDatasetBaseline[group] || 0);
|
|
122
123
|
return previousPoints.some(function (point) {
|
|
123
124
|
return point instanceof Date;
|
|
@@ -132,8 +133,8 @@ function addLayoutData(props, datasets, index) {
|
|
|
132
133
|
var yOffset = getY0(datum, index, datasets) || 0;
|
|
133
134
|
return (0, _assign2.default)({}, datum, {
|
|
134
135
|
_y0: !(datum._y instanceof Date) ? yOffset : yOffset ? new Date(yOffset) : datum._y,
|
|
135
|
-
_y1: datum._y === null ? null : datum._y instanceof Date ? new Date(
|
|
136
|
-
_x1: datum._x === null ? null : datum._x instanceof Date ? new Date(
|
|
136
|
+
_y1: datum._y === null ? null : datum._y instanceof Date ? new Date(Number(datum._y) + Number(yOffset)) : datum._y + yOffset,
|
|
137
|
+
_x1: datum._x === null ? null : datum._x instanceof Date ? new Date(Number(datum._x) + Number(xOffset)) : datum._x + xOffset
|
|
137
138
|
});
|
|
138
139
|
});
|
|
139
140
|
}
|
|
@@ -210,7 +211,8 @@ function getCalculatedProps(props, childComponents) {
|
|
|
210
211
|
var withoutSharedEvents = function (props) {
|
|
211
212
|
var children = props.children;
|
|
212
213
|
|
|
213
|
-
var modifiedChildren = _react.default.Children.toArray(children).map(function (
|
|
214
|
+
var modifiedChildren = _react.default.Children.toArray(children).map(function (_child) {
|
|
215
|
+
var child = _child;
|
|
214
216
|
return _objectSpread(_objectSpread({}, child), {}, {
|
|
215
217
|
props: _victoryCore.Helpers.omit(child.props, ["sharedEvents"])
|
|
216
218
|
});
|
package/lib/index.d.ts
CHANGED
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
CategoryPropType,
|
|
4
|
-
ColorScalePropType,
|
|
5
|
-
DomainPropType,
|
|
6
|
-
EventPropTypeInterface,
|
|
7
|
-
StringOrNumberOrCallback,
|
|
8
|
-
VictoryCommonProps,
|
|
9
|
-
VictoryLabelableProps,
|
|
10
|
-
VictoryMultiLabelableProps,
|
|
11
|
-
VictoryStyleInterface,
|
|
12
|
-
} from "victory-core";
|
|
13
|
-
|
|
14
|
-
export type VictoryStackTTargetType = "data" | "labels" | "parent";
|
|
15
|
-
|
|
16
|
-
export interface VictoryStackProps
|
|
17
|
-
extends VictoryCommonProps,
|
|
18
|
-
VictoryLabelableProps,
|
|
19
|
-
VictoryMultiLabelableProps {
|
|
20
|
-
bins?: number | number[] | Date[];
|
|
21
|
-
categories?: CategoryPropType;
|
|
22
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
23
|
-
colorScale?: ColorScalePropType;
|
|
24
|
-
domain?: DomainPropType;
|
|
25
|
-
events?: EventPropTypeInterface<
|
|
26
|
-
VictoryStackTTargetType,
|
|
27
|
-
StringOrNumberOrCallback
|
|
28
|
-
>[];
|
|
29
|
-
eventKey?: StringOrNumberOrCallback;
|
|
30
|
-
fillInMissingData?: boolean;
|
|
31
|
-
style?: VictoryStyleInterface;
|
|
32
|
-
xOffset?: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class VictoryStack extends React.Component<VictoryStackProps, any> {}
|
|
1
|
+
export * from "./victory-stack";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "VictoryStack", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _victoryStack.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
6
|
|
|
13
|
-
var _victoryStack =
|
|
7
|
+
var _victoryStack = require("./victory-stack");
|
|
14
8
|
|
|
15
|
-
function
|
|
9
|
+
Object.keys(_victoryStack).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _victoryStack[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _victoryStack[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
16
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CategoryPropType, ColorScalePropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryLabelableProps, VictoryMultiLabelableProps, VictoryStyleInterface, VictoryComponentConfiguration } from "victory-core";
|
|
4
|
+
export declare type VictoryStackTTargetType = "data" | "labels" | "parent";
|
|
5
|
+
export interface VictoryStackProps extends VictoryCommonProps, VictoryLabelableProps, VictoryMultiLabelableProps {
|
|
6
|
+
bins?: number | number[] | Date[];
|
|
7
|
+
categories?: CategoryPropType;
|
|
8
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
9
|
+
colorScale?: ColorScalePropType;
|
|
10
|
+
domain?: DomainPropType;
|
|
11
|
+
events?: EventPropTypeInterface<VictoryStackTTargetType, StringOrNumberOrCallback>[];
|
|
12
|
+
eventKey?: StringOrNumberOrCallback;
|
|
13
|
+
fillInMissingData?: boolean;
|
|
14
|
+
style?: VictoryStyleInterface;
|
|
15
|
+
xOffset?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const VictoryStack: React.NamedExoticComponent<any> & {
|
|
18
|
+
readonly type: {
|
|
19
|
+
(initialProps: any): JSX.Element;
|
|
20
|
+
propTypes: {
|
|
21
|
+
bins: PropTypes.Requireable<number | (number | Date | null | undefined)[]>;
|
|
22
|
+
categories: PropTypes.Requireable<(string | null | undefined)[] | PropTypes.InferProps<{
|
|
23
|
+
x: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
24
|
+
y: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
25
|
+
}>>;
|
|
26
|
+
children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
27
|
+
colorScale: PropTypes.Requireable<string | (string | null | undefined)[]>;
|
|
28
|
+
fillInMissingData: PropTypes.Requireable<boolean>;
|
|
29
|
+
horizontal: PropTypes.Requireable<boolean>;
|
|
30
|
+
labelComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
31
|
+
labels: PropTypes.Requireable<any[] | ((...args: any[]) => any)>;
|
|
32
|
+
style: PropTypes.Requireable<PropTypes.InferProps<{
|
|
33
|
+
parent: PropTypes.Requireable<object>;
|
|
34
|
+
data: PropTypes.Requireable<object>;
|
|
35
|
+
labels: PropTypes.Requireable<object>;
|
|
36
|
+
}>>;
|
|
37
|
+
xOffset: PropTypes.Requireable<number>;
|
|
38
|
+
theme?: React.Validator<import("victory-core").VictoryThemeDefinition | null | undefined> | undefined;
|
|
39
|
+
animate?: React.Validator<boolean | import("victory-core").AnimatePropTypeInterface | null | undefined> | undefined;
|
|
40
|
+
containerComponent?: React.Validator<React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined> | undefined;
|
|
41
|
+
domainPadding?: React.Validator<import("victory-core").ForAxes<import("victory-core").PaddingType> | null | undefined> | undefined;
|
|
42
|
+
externalEventMutations?: React.Validator<import("victory-core").EventCallbackInterface<string | string[], import("victory-core").StringOrNumberOrList>[] | null | undefined> | undefined;
|
|
43
|
+
groupComponent?: React.Validator<React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined> | undefined;
|
|
44
|
+
height?: React.Validator<number | null | undefined> | undefined;
|
|
45
|
+
maxDomain?: React.Validator<number | {
|
|
46
|
+
x?: number | undefined;
|
|
47
|
+
y?: number | undefined;
|
|
48
|
+
} | null | undefined> | undefined;
|
|
49
|
+
minDomain?: React.Validator<number | {
|
|
50
|
+
x?: number | undefined;
|
|
51
|
+
y?: number | undefined;
|
|
52
|
+
} | null | undefined> | undefined;
|
|
53
|
+
name?: React.Validator<string | null | undefined> | undefined;
|
|
54
|
+
origin?: React.Validator<import("victory-core").OriginType | null | undefined> | undefined;
|
|
55
|
+
padding?: React.Validator<import("victory-core").PaddingProps | null | undefined> | undefined;
|
|
56
|
+
polar?: React.Validator<boolean | null | undefined> | undefined;
|
|
57
|
+
range?: React.Validator<import("victory-core").ForAxes<import("victory-core").RangeTuple> | null | undefined> | undefined;
|
|
58
|
+
scale?: React.Validator<import("victory-core").D3Scale<any> | import("victory-core").ScaleName | {
|
|
59
|
+
x?: import("victory-core").D3Scale<any> | import("victory-core").ScaleName | undefined;
|
|
60
|
+
y?: import("victory-core").D3Scale<any> | import("victory-core").ScaleName | undefined;
|
|
61
|
+
} | null | undefined> | undefined;
|
|
62
|
+
sharedEvents?: React.Validator<{
|
|
63
|
+
events: any[];
|
|
64
|
+
getEventState: Function;
|
|
65
|
+
} | null | undefined> | undefined;
|
|
66
|
+
singleQuadrantDomainPadding?: React.Validator<boolean | {
|
|
67
|
+
x?: boolean | undefined;
|
|
68
|
+
y?: boolean | undefined;
|
|
69
|
+
} | null | undefined> | undefined;
|
|
70
|
+
standalone?: React.Validator<boolean | null | undefined> | undefined;
|
|
71
|
+
width?: React.Validator<number | null | undefined> | undefined;
|
|
72
|
+
};
|
|
73
|
+
defaultProps: {
|
|
74
|
+
containerComponent: JSX.Element;
|
|
75
|
+
groupComponent: JSX.Element;
|
|
76
|
+
standalone: boolean;
|
|
77
|
+
theme: import("victory-core").VictoryThemeDefinition;
|
|
78
|
+
fillInMissingData: boolean;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
} & VictoryComponentConfiguration<VictoryStackProps>;
|
|
82
|
+
//# sourceMappingURL=victory-stack.d.ts.map
|