victory-area 36.4.1 → 36.5.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/dist/victory-area.js +894 -789
- package/dist/victory-area.min.js +1 -1
- package/es/area.d.ts +13 -0
- package/es/area.js +13 -31
- package/es/helper-methods.d.ts +3 -0
- package/es/helper-methods.js +2 -1
- package/es/index.d.ts +3 -41
- package/es/index.js +3 -2
- package/es/victory-area.d.ts +150 -0
- package/es/victory-area.js +36 -41
- package/lib/area.d.ts +13 -0
- package/lib/area.js +19 -30
- package/lib/helper-methods.d.ts +3 -0
- package/lib/helper-methods.js +2 -1
- package/lib/index.d.ts +3 -41
- package/lib/index.js +24 -15
- package/lib/victory-area.d.ts +150 -0
- package/lib/victory-area.js +39 -45
- package/package.json +5 -5
- package/src/{area.js → area.tsx} +44 -60
- package/src/{helper-methods.js → helper-methods.tsx} +10 -10
- package/src/index.ts +2 -0
- package/src/{victory-area.js → victory-area.tsx} +44 -15
- package/src/index.d.ts +0 -41
- package/src/index.js +0 -2
package/es/area.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { VictoryCommonPrimitiveProps, VictoryCommonThemeProps } from "victory-core";
|
|
3
|
+
/**
|
|
4
|
+
* The area primitive used by VictoryArea
|
|
5
|
+
*/
|
|
6
|
+
export declare const Area: React.FC<AreaProps>;
|
|
7
|
+
export interface AreaProps extends VictoryCommonPrimitiveProps {
|
|
8
|
+
horizontal?: VictoryCommonThemeProps["horizontal"];
|
|
9
|
+
groupComponent?: React.ReactElement;
|
|
10
|
+
interpolation?: string | Function;
|
|
11
|
+
pathComponent?: React.ReactElement;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=area.d.ts.map
|
package/es/area.js
CHANGED
|
@@ -10,7 +10,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10
10
|
import React from "react";
|
|
11
11
|
import PropTypes from "prop-types";
|
|
12
12
|
import * as d3Shape from "victory-vendor/d3-shape";
|
|
13
|
-
import { Helpers, CommonProps, Path, UserProps } from "victory-core";
|
|
13
|
+
import { Helpers, CommonProps, Path, UserProps, LineHelpers } from "victory-core";
|
|
14
14
|
|
|
15
15
|
var defined = function (d) {
|
|
16
16
|
var y = d._y1 !== undefined ? d._y1 : d._y;
|
|
@@ -42,39 +42,18 @@ var getAngleAccessor = function (scale) {
|
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
var
|
|
46
|
-
// d3 shape changed the naming scheme for interpolators from "basis" -> "curveBasis" etc.
|
|
47
|
-
var capitalize = function (s) {
|
|
48
|
-
return s && s[0].toUpperCase() + s.slice(1);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return "curve".concat(capitalize(interpolation));
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
var getLineFunction = function (props) {
|
|
55
|
-
var polar = props.polar,
|
|
56
|
-
scale = props.scale,
|
|
57
|
-
horizontal = props.horizontal;
|
|
58
|
-
var interpolationFunction = typeof props.interpolation === "function" && props.interpolation;
|
|
59
|
-
var interpolationName = typeof props.interpolation === "string" && toNewName(props.interpolation);
|
|
60
|
-
return polar ? d3Shape.lineRadial().defined(defined).curve(interpolationFunction || d3Shape["".concat(interpolationName, "Closed")]).angle(getAngleAccessor(scale)).radius(getYAccessor(scale)) : d3Shape.line().defined(defined).curve(interpolationFunction || d3Shape[interpolationName]).x(horizontal ? getYAccessor(scale) : getXAccessor(scale)).y(horizontal ? getXAccessor(scale) : getYAccessor(scale));
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
var getCartesianArea = function (props, interpolation) {
|
|
45
|
+
var getCartesianArea = function (props) {
|
|
64
46
|
var horizontal = props.horizontal,
|
|
65
47
|
scale = props.scale;
|
|
66
|
-
var interpolationFunction =
|
|
67
|
-
|
|
68
|
-
return horizontal ? d3Shape.area().defined(defined).curve(interpolationFunction || d3Shape[interpolationName]).x0(getY0Accessor(scale)).x1(getYAccessor(scale)).y(getXAccessor(scale)) : d3Shape.area().defined(defined).curve(interpolationFunction || d3Shape[interpolationName]).x(getXAccessor(scale)).y1(getYAccessor(scale)).y0(getY0Accessor(scale));
|
|
48
|
+
var interpolationFunction = LineHelpers.getInterpolationFunction(props);
|
|
49
|
+
return horizontal ? d3Shape.area().defined(defined).curve(interpolationFunction).x0(getY0Accessor(scale)).x1(getYAccessor(scale)).y(getXAccessor(scale)) : d3Shape.area().defined(defined).curve(interpolationFunction).x(getXAccessor(scale)).y1(getYAccessor(scale)).y0(getY0Accessor(scale));
|
|
69
50
|
};
|
|
70
51
|
|
|
71
52
|
var getAreaFunction = function (props) {
|
|
72
53
|
var polar = props.polar,
|
|
73
54
|
scale = props.scale;
|
|
74
|
-
var interpolationFunction =
|
|
75
|
-
|
|
76
|
-
var interpolation = interpolationFunction || interpolationName;
|
|
77
|
-
return polar ? d3Shape.radialArea().defined(defined).curve(interpolationFunction || d3Shape["".concat(interpolationName, "Closed")]).angle(getAngleAccessor(scale)).outerRadius(getYAccessor(scale)).innerRadius(getY0Accessor(scale)) : getCartesianArea(props, interpolation);
|
|
55
|
+
var interpolationFunction = LineHelpers.getInterpolationFunction(props);
|
|
56
|
+
return polar ? d3Shape.radialArea().defined(defined).curve(interpolationFunction).angle(getAngleAccessor(scale)).outerRadius(getYAccessor(scale)).innerRadius(getY0Accessor(scale)) : getCartesianArea(props);
|
|
78
57
|
};
|
|
79
58
|
|
|
80
59
|
var evaluateProps = function (props) {
|
|
@@ -101,8 +80,12 @@ var evaluateProps = function (props) {
|
|
|
101
80
|
tabIndex: tabIndex
|
|
102
81
|
});
|
|
103
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* The area primitive used by VictoryArea
|
|
85
|
+
*/
|
|
104
86
|
|
|
105
|
-
|
|
87
|
+
|
|
88
|
+
export var Area = function (props) {
|
|
106
89
|
props = evaluateProps(props);
|
|
107
90
|
var _props = props,
|
|
108
91
|
ariaLabel = _props.ariaLabel,
|
|
@@ -125,7 +108,7 @@ var Area = function (props) {
|
|
|
125
108
|
var transform = props.transform || defaultTransform;
|
|
126
109
|
var renderLine = style.stroke && style.stroke !== "none" && style.stroke !== "transparent";
|
|
127
110
|
var areaFunction = getAreaFunction(props);
|
|
128
|
-
var lineFunction = renderLine && getLineFunction(props);
|
|
111
|
+
var lineFunction = renderLine && LineHelpers.getLineFunction(props);
|
|
129
112
|
var areaStroke = style.stroke ? "none" : style.fill;
|
|
130
113
|
|
|
131
114
|
var sharedProps = _objectSpread(_objectSpread({
|
|
@@ -157,7 +140,6 @@ var Area = function (props) {
|
|
|
157
140
|
}, sharedProps)) : null;
|
|
158
141
|
return renderLine ? /*#__PURE__*/React.cloneElement(groupComponent, userProps, [area, line]) : area;
|
|
159
142
|
};
|
|
160
|
-
|
|
161
143
|
Area.propTypes = _objectSpread(_objectSpread({}, CommonProps.primitiveProps), {}, {
|
|
162
144
|
groupComponent: PropTypes.element,
|
|
163
145
|
interpolation: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
@@ -169,4 +151,4 @@ Area.defaultProps = {
|
|
|
169
151
|
role: "presentation",
|
|
170
152
|
shapeRendering: "auto"
|
|
171
153
|
};
|
|
172
|
-
|
|
154
|
+
//# sourceMappingURL=area.js.map
|
package/es/helper-methods.js
CHANGED
package/es/index.d.ts
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
InterpolationPropType,
|
|
5
|
-
StringOrNumberOrCallback,
|
|
6
|
-
VictoryCommonProps,
|
|
7
|
-
VictoryCommonPrimitiveProps,
|
|
8
|
-
VictoryDatableProps,
|
|
9
|
-
VictoryMultiLabelableProps,
|
|
10
|
-
VictoryStyleInterface
|
|
11
|
-
} from "victory-core";
|
|
12
|
-
|
|
13
|
-
export type VictoryAreaTTargetType = "data" | "labels" | "parent";
|
|
14
|
-
|
|
15
|
-
export interface VictoryAreaProps
|
|
16
|
-
extends VictoryCommonProps,
|
|
17
|
-
VictoryDatableProps,
|
|
18
|
-
VictoryMultiLabelableProps {
|
|
19
|
-
eventKey?: string[] | number[] | StringOrNumberOrCallback;
|
|
20
|
-
events?: EventPropTypeInterface<VictoryAreaTTargetType, string | number>[];
|
|
21
|
-
interpolation?: InterpolationPropType | Function;
|
|
22
|
-
samples?: number;
|
|
23
|
-
style?: VictoryStyleInterface;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Draw area charts with React. VictoryArea is a composable component, so it doesn"t include axes.
|
|
28
|
-
* Add VictoryArea as a child of VictoryChart for a complete chart.
|
|
29
|
-
*/
|
|
30
|
-
export class VictoryArea extends React.Component<VictoryAreaProps, any> {}
|
|
31
|
-
|
|
32
|
-
export interface AreaProps extends VictoryCommonPrimitiveProps {
|
|
33
|
-
groupComponent?: React.ReactElement;
|
|
34
|
-
interpolation?: string | Function;
|
|
35
|
-
pathComponent?: React.ReactElement;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The area primitive used by VictoryArea
|
|
40
|
-
*/
|
|
41
|
-
export class Area extends React.Component<AreaProps, any> {}
|
|
1
|
+
export * from "./victory-area";
|
|
2
|
+
export * from "./area";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
package/es/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from "./victory-area";
|
|
2
|
+
export * from "./area";
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Data, Domain, EventPropTypeInterface, InterpolationPropType, StringOrNumberOrCallback, VictoryCommonProps, VictoryDatableProps, VictoryMultiLabelableProps, VictoryStyleInterface, EventsMixinClass } from "victory-core";
|
|
4
|
+
export declare type VictoryAreaTTargetType = "data" | "labels" | "parent";
|
|
5
|
+
export interface VictoryAreaProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabelableProps {
|
|
6
|
+
eventKey?: string[] | number[] | StringOrNumberOrCallback;
|
|
7
|
+
events?: EventPropTypeInterface<VictoryAreaTTargetType, string | number>[];
|
|
8
|
+
interpolation?: InterpolationPropType | Function;
|
|
9
|
+
samples?: number;
|
|
10
|
+
style?: VictoryStyleInterface;
|
|
11
|
+
}
|
|
12
|
+
interface VictoryAreaBase extends EventsMixinClass<VictoryAreaProps> {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Draw area charts with React. VictoryArea is a composable component, so it doesn't include axes.
|
|
16
|
+
* Add VictoryArea as a child of VictoryChart for a complete chart.
|
|
17
|
+
*/
|
|
18
|
+
declare class VictoryAreaBase extends React.Component<VictoryAreaProps> {
|
|
19
|
+
static animationWhitelist: string[];
|
|
20
|
+
static propTypes: {
|
|
21
|
+
interpolation: PropTypes.Requireable<string | ((...args: any[]) => any)>;
|
|
22
|
+
label: PropTypes.Validator<string | null | undefined>;
|
|
23
|
+
categories?: React.Validator<import("victory-core").CategoryPropType | null | undefined> | undefined;
|
|
24
|
+
data?: React.Validator<readonly any[] | null | undefined> | undefined;
|
|
25
|
+
dataComponent?: React.Validator<React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined> | undefined;
|
|
26
|
+
domain?: React.Validator<import("victory-core").ForAxes<import("victory-core").DomainTuple> | null | undefined> | undefined;
|
|
27
|
+
domainPadding?: React.Validator<import("victory-core").ForAxes<import("victory-core").PaddingType> | null | undefined> | undefined;
|
|
28
|
+
samples?: React.Validator<number | null | undefined> | undefined;
|
|
29
|
+
sortKey?: React.Validator<import("victory-core").DataGetterPropType | null | undefined> | undefined;
|
|
30
|
+
sortOrder?: React.Validator<import("victory-core").SortOrderPropType | null | undefined> | undefined;
|
|
31
|
+
x?: React.Validator<import("victory-core").DataGetterPropType | null | undefined> | undefined;
|
|
32
|
+
y?: React.Validator<import("victory-core").DataGetterPropType | null | undefined> | undefined;
|
|
33
|
+
y0?: React.Validator<import("victory-core").DataGetterPropType | null | undefined> | undefined;
|
|
34
|
+
theme?: React.Validator<import("victory-core").VictoryThemeDefinition | null | undefined> | undefined;
|
|
35
|
+
animate?: React.Validator<boolean | import("victory-core").AnimatePropTypeInterface | null | undefined> | undefined;
|
|
36
|
+
colorScale?: React.Validator<import("victory-core").ColorScalePropType | null | undefined> | undefined;
|
|
37
|
+
containerComponent?: React.Validator<React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined> | undefined;
|
|
38
|
+
externalEventMutations?: React.Validator<import("victory-core").EventCallbackInterface<string | string[], import("victory-core").StringOrNumberOrList>[] | null | undefined> | undefined;
|
|
39
|
+
groupComponent?: React.Validator<React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined> | undefined;
|
|
40
|
+
height?: React.Validator<number | null | undefined> | undefined;
|
|
41
|
+
horizontal?: React.Validator<boolean | null | undefined> | undefined;
|
|
42
|
+
maxDomain?: React.Validator<number | {
|
|
43
|
+
x?: number | undefined;
|
|
44
|
+
y?: number | undefined;
|
|
45
|
+
} | null | undefined> | undefined;
|
|
46
|
+
minDomain?: React.Validator<number | {
|
|
47
|
+
x?: number | undefined;
|
|
48
|
+
y?: number | undefined;
|
|
49
|
+
} | null | undefined> | undefined;
|
|
50
|
+
name?: React.Validator<string | null | undefined> | undefined;
|
|
51
|
+
origin?: React.Validator<import("victory-core").OriginType | null | undefined> | undefined;
|
|
52
|
+
padding?: React.Validator<import("victory-core").PaddingProps | null | undefined> | undefined;
|
|
53
|
+
polar?: React.Validator<boolean | null | undefined> | undefined;
|
|
54
|
+
range?: React.Validator<import("victory-core").ForAxes<import("victory-core").RangeTuple> | null | undefined> | undefined;
|
|
55
|
+
scale?: React.Validator<import("victory-core").D3Scale<any> | import("victory-core").ScaleName | {
|
|
56
|
+
x?: import("victory-core").D3Scale<any> | import("victory-core").ScaleName | undefined;
|
|
57
|
+
y?: import("victory-core").D3Scale<any> | import("victory-core").ScaleName | undefined;
|
|
58
|
+
} | null | undefined> | undefined;
|
|
59
|
+
sharedEvents?: React.Validator<{
|
|
60
|
+
events: any[];
|
|
61
|
+
getEventState: Function;
|
|
62
|
+
} | null | undefined> | undefined;
|
|
63
|
+
singleQuadrantDomainPadding?: React.Validator<boolean | {
|
|
64
|
+
x?: boolean | undefined;
|
|
65
|
+
y?: boolean | undefined;
|
|
66
|
+
} | null | undefined> | undefined;
|
|
67
|
+
standalone?: React.Validator<boolean | null | undefined> | undefined;
|
|
68
|
+
width?: React.Validator<number | null | undefined> | undefined;
|
|
69
|
+
};
|
|
70
|
+
static defaultProps: {
|
|
71
|
+
containerComponent: JSX.Element;
|
|
72
|
+
dataComponent: JSX.Element;
|
|
73
|
+
groupComponent: JSX.Element;
|
|
74
|
+
labelComponent: JSX.Element;
|
|
75
|
+
samples: number;
|
|
76
|
+
sortKey: string;
|
|
77
|
+
sortOrder: string;
|
|
78
|
+
standalone: boolean;
|
|
79
|
+
theme: import("victory-core").VictoryThemeDefinition;
|
|
80
|
+
};
|
|
81
|
+
static displayName: string;
|
|
82
|
+
static role: string;
|
|
83
|
+
static continuous: boolean;
|
|
84
|
+
static defaultTransitions: import("victory-core").AnimatePropTypeInterface;
|
|
85
|
+
static defaultPolarTransitions: import("victory-core").AnimatePropTypeInterface;
|
|
86
|
+
static getDomain: typeof Domain.getDomainWithZero;
|
|
87
|
+
static getData: typeof Data.getData;
|
|
88
|
+
static getBaseProps: (props: any) => any;
|
|
89
|
+
static expectedComponents: string[];
|
|
90
|
+
shouldAnimate(): boolean;
|
|
91
|
+
render(): any;
|
|
92
|
+
}
|
|
93
|
+
export declare const VictoryArea: {
|
|
94
|
+
new (props: import("victory-core").EventMixinCommonProps): {
|
|
95
|
+
state: {};
|
|
96
|
+
getEventState: (eventKey: string | number, namespace: string, childType?: string | undefined) => any;
|
|
97
|
+
getScopedEvents: (events: any, namespace: any, childType: any, baseProps: any) => {};
|
|
98
|
+
getEvents: (p: any, target: any, eventKey: any) => any;
|
|
99
|
+
externalMutations: {} | undefined;
|
|
100
|
+
calculatedState: {};
|
|
101
|
+
globalEvents: {};
|
|
102
|
+
prevGlobalEventKeys: string[];
|
|
103
|
+
boundGlobalEvents: {};
|
|
104
|
+
shouldComponentUpdate(nextProps: import("victory-core").EventMixinCommonProps): boolean;
|
|
105
|
+
componentDidMount(): void;
|
|
106
|
+
componentDidUpdate(prevProps: any): void;
|
|
107
|
+
componentWillUnmount(): void;
|
|
108
|
+
addGlobalListener(key: any): void;
|
|
109
|
+
removeGlobalListener(key: any): void;
|
|
110
|
+
getStateChanges(props: any): {};
|
|
111
|
+
applyExternalMutations(props: any, externalMutations: any): void;
|
|
112
|
+
getCalculatedValues(props: any): import("victory-core").EventMixinCalculatedValues;
|
|
113
|
+
getExternalMutations(props: import("victory-core").EventMixinCommonProps): {} | undefined;
|
|
114
|
+
cacheValues(obj: any): void;
|
|
115
|
+
getBaseProps(props: any, getSharedEventState: any): Record<string, object>;
|
|
116
|
+
getAllEvents(props: any): any;
|
|
117
|
+
getComponentProps(component: any, type: any, index: any): any;
|
|
118
|
+
renderContainer(component: any, children: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
119
|
+
animateComponent(props: import("victory-core").EventMixinCommonProps, defaultAnimationWhitelist: string[]): JSX.Element;
|
|
120
|
+
renderContinuousData(props: import("victory-core").EventMixinCommonProps): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
121
|
+
renderData(props: any, shouldRenderDatum?: ((datum: any) => boolean) | undefined): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
122
|
+
context: unknown;
|
|
123
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("victory-core").EventMixinCommonProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
124
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
125
|
+
render(): React.ReactNode;
|
|
126
|
+
readonly props: Readonly<import("victory-core").EventMixinCommonProps>;
|
|
127
|
+
refs: {
|
|
128
|
+
[key: string]: React.ReactInstance;
|
|
129
|
+
};
|
|
130
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
131
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<import("victory-core").EventMixinCommonProps>, prevState: Readonly<{}>): any;
|
|
132
|
+
componentWillMount?(): void;
|
|
133
|
+
UNSAFE_componentWillMount?(): void;
|
|
134
|
+
componentWillReceiveProps?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextContext: any): void;
|
|
135
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextContext: any): void;
|
|
136
|
+
componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
137
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
138
|
+
componentEvents: import("victory-core/lib/victory-util/events").ComponentEvent[];
|
|
139
|
+
getSharedEventState: (key: string, value: string) => unknown;
|
|
140
|
+
baseProps: Record<string, object>;
|
|
141
|
+
dataKeys: string[];
|
|
142
|
+
hasEvents: unknown;
|
|
143
|
+
events: unknown;
|
|
144
|
+
};
|
|
145
|
+
getBaseProps?(props: import("victory-core").EventMixinCommonProps): Record<string, object>;
|
|
146
|
+
role?: string | undefined;
|
|
147
|
+
expectedComponents?: string[] | undefined;
|
|
148
|
+
} & typeof VictoryAreaBase;
|
|
149
|
+
export {};
|
|
150
|
+
//# sourceMappingURL=victory-area.d.ts.map
|
package/es/victory-area.js
CHANGED
|
@@ -2,6 +2,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
2
2
|
|
|
3
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
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
|
+
|
|
5
7
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
8
|
|
|
7
9
|
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); } }
|
|
@@ -10,7 +12,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
10
12
|
|
|
11
13
|
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); }
|
|
12
14
|
|
|
13
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
16
|
|
|
15
17
|
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); }; }
|
|
16
18
|
|
|
@@ -20,14 +22,12 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
20
22
|
|
|
21
23
|
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; } }
|
|
22
24
|
|
|
23
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
-
|
|
25
|
-
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; }
|
|
25
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
26
26
|
|
|
27
27
|
import PropTypes from "prop-types";
|
|
28
28
|
import React from "react";
|
|
29
29
|
import { getBaseProps } from "./helper-methods";
|
|
30
|
-
import Area from "./area";
|
|
30
|
+
import { Area } from "./area";
|
|
31
31
|
import { PropTypes as CustomPropTypes, Helpers, VictoryLabel, VictoryContainer, CommonProps, DefaultTransitions, VictoryClipContainer, addEvents, VictoryTheme, Data, Domain, UserProps } from "victory-core";
|
|
32
32
|
var fallbackProps = {
|
|
33
33
|
width: 450,
|
|
@@ -47,18 +47,22 @@ var options = {
|
|
|
47
47
|
}]
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Draw area charts with React. VictoryArea is a composable component, so it doesn't include axes.
|
|
52
|
+
* Add VictoryArea as a child of VictoryChart for a complete chart.
|
|
53
|
+
*/
|
|
54
|
+
var VictoryAreaBase = /*#__PURE__*/function (_React$Component) {
|
|
55
|
+
_inherits(VictoryAreaBase, _React$Component);
|
|
52
56
|
|
|
53
|
-
var _super = _createSuper(
|
|
57
|
+
var _super = _createSuper(VictoryAreaBase);
|
|
54
58
|
|
|
55
|
-
function
|
|
56
|
-
_classCallCheck(this,
|
|
59
|
+
function VictoryAreaBase() {
|
|
60
|
+
_classCallCheck(this, VictoryAreaBase);
|
|
57
61
|
|
|
58
62
|
return _super.apply(this, arguments);
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
_createClass(
|
|
65
|
+
_createClass(VictoryAreaBase, [{
|
|
62
66
|
key: "shouldAnimate",
|
|
63
67
|
value: // Overridden in native versions
|
|
64
68
|
function shouldAnimate() {
|
|
@@ -67,8 +71,8 @@ var VictoryArea = /*#__PURE__*/function (_React$Component) {
|
|
|
67
71
|
}, {
|
|
68
72
|
key: "render",
|
|
69
73
|
value: function render() {
|
|
70
|
-
var animationWhitelist =
|
|
71
|
-
role =
|
|
74
|
+
var animationWhitelist = VictoryAreaBase.animationWhitelist,
|
|
75
|
+
role = VictoryAreaBase.role;
|
|
72
76
|
var props = Helpers.modifyProps(this.props, fallbackProps, role);
|
|
73
77
|
|
|
74
78
|
if (this.shouldAnimate()) {
|
|
@@ -81,17 +85,15 @@ var VictoryArea = /*#__PURE__*/function (_React$Component) {
|
|
|
81
85
|
}
|
|
82
86
|
}]);
|
|
83
87
|
|
|
84
|
-
return
|
|
88
|
+
return VictoryAreaBase;
|
|
85
89
|
}(React.Component);
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
_defineProperty(VictoryArea, "propTypes", _objectSpread(_objectSpread(_objectSpread({}, CommonProps.baseProps), CommonProps.dataProps), {}, {
|
|
91
|
+
VictoryAreaBase.animationWhitelist = ["data", "domain", "height", "padding", "style", "width"];
|
|
92
|
+
VictoryAreaBase.propTypes = _objectSpread(_objectSpread(_objectSpread({}, CommonProps.baseProps), CommonProps.dataProps), {}, {
|
|
90
93
|
interpolation: PropTypes.oneOfType([PropTypes.oneOf(["basis", "cardinal", "catmullRom", "linear", "monotoneX", "monotoneY", "natural", "step", "stepAfter", "stepBefore"]), PropTypes.func]),
|
|
91
94
|
label: CustomPropTypes.deprecated(PropTypes.string, "Use `labels` instead for individual data labels")
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
_defineProperty(VictoryArea, "defaultProps", {
|
|
95
|
+
});
|
|
96
|
+
VictoryAreaBase.defaultProps = {
|
|
95
97
|
containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
|
|
96
98
|
dataComponent: /*#__PURE__*/React.createElement(Area, null),
|
|
97
99
|
groupComponent: /*#__PURE__*/React.createElement(VictoryClipContainer, null),
|
|
@@ -103,26 +105,19 @@ _defineProperty(VictoryArea, "defaultProps", {
|
|
|
103
105
|
sortOrder: "ascending",
|
|
104
106
|
standalone: true,
|
|
105
107
|
theme: VictoryTheme.grayscale
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
_defineProperty(VictoryArea, "defaultPolarTransitions", DefaultTransitions.continuousPolarTransitions());
|
|
117
|
-
|
|
118
|
-
_defineProperty(VictoryArea, "getDomain", Domain.getDomainWithZero);
|
|
119
|
-
|
|
120
|
-
_defineProperty(VictoryArea, "getData", Data.getData);
|
|
121
|
-
|
|
122
|
-
_defineProperty(VictoryArea, "getBaseProps", function (props) {
|
|
108
|
+
};
|
|
109
|
+
VictoryAreaBase.displayName = "VictoryArea";
|
|
110
|
+
VictoryAreaBase.role = "area";
|
|
111
|
+
VictoryAreaBase.continuous = true;
|
|
112
|
+
VictoryAreaBase.defaultTransitions = DefaultTransitions.continuousTransitions();
|
|
113
|
+
VictoryAreaBase.defaultPolarTransitions = DefaultTransitions.continuousPolarTransitions();
|
|
114
|
+
VictoryAreaBase.getDomain = Domain.getDomainWithZero;
|
|
115
|
+
VictoryAreaBase.getData = Data.getData;
|
|
116
|
+
|
|
117
|
+
VictoryAreaBase.getBaseProps = function (props) {
|
|
123
118
|
return getBaseProps(props, fallbackProps);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
_defineProperty(VictoryArea, "expectedComponents", ["dataComponent", "labelComponent", "groupComponent", "containerComponent"]);
|
|
119
|
+
};
|
|
127
120
|
|
|
128
|
-
|
|
121
|
+
VictoryAreaBase.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"];
|
|
122
|
+
export var VictoryArea = addEvents(VictoryAreaBase, options);
|
|
123
|
+
//# sourceMappingURL=victory-area.js.map
|
package/lib/area.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { VictoryCommonPrimitiveProps, VictoryCommonThemeProps } from "victory-core";
|
|
3
|
+
/**
|
|
4
|
+
* The area primitive used by VictoryArea
|
|
5
|
+
*/
|
|
6
|
+
export declare const Area: React.FC<AreaProps>;
|
|
7
|
+
export interface AreaProps extends VictoryCommonPrimitiveProps {
|
|
8
|
+
horizontal?: VictoryCommonThemeProps["horizontal"];
|
|
9
|
+
groupComponent?: React.ReactElement;
|
|
10
|
+
interpolation?: string | Function;
|
|
11
|
+
pathComponent?: React.ReactElement;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=area.d.ts.map
|
package/lib/area.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.Area = void 0;
|
|
7
7
|
|
|
8
8
|
var _assign2 = _interopRequireDefault(require("lodash/assign"));
|
|
9
9
|
|
|
@@ -57,39 +57,22 @@ var getAngleAccessor = function (scale) {
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
var
|
|
61
|
-
// d3 shape changed the naming scheme for interpolators from "basis" -> "curveBasis" etc.
|
|
62
|
-
var capitalize = function (s) {
|
|
63
|
-
return s && s[0].toUpperCase() + s.slice(1);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
return "curve".concat(capitalize(interpolation));
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
var getLineFunction = function (props) {
|
|
70
|
-
var polar = props.polar,
|
|
71
|
-
scale = props.scale,
|
|
72
|
-
horizontal = props.horizontal;
|
|
73
|
-
var interpolationFunction = typeof props.interpolation === "function" && props.interpolation;
|
|
74
|
-
var interpolationName = typeof props.interpolation === "string" && toNewName(props.interpolation);
|
|
75
|
-
return polar ? d3Shape.lineRadial().defined(defined).curve(interpolationFunction || d3Shape["".concat(interpolationName, "Closed")]).angle(getAngleAccessor(scale)).radius(getYAccessor(scale)) : d3Shape.line().defined(defined).curve(interpolationFunction || d3Shape[interpolationName]).x(horizontal ? getYAccessor(scale) : getXAccessor(scale)).y(horizontal ? getXAccessor(scale) : getYAccessor(scale));
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
var getCartesianArea = function (props, interpolation) {
|
|
60
|
+
var getCartesianArea = function (props) {
|
|
79
61
|
var horizontal = props.horizontal,
|
|
80
62
|
scale = props.scale;
|
|
81
|
-
|
|
82
|
-
var
|
|
83
|
-
|
|
63
|
+
|
|
64
|
+
var interpolationFunction = _victoryCore.LineHelpers.getInterpolationFunction(props);
|
|
65
|
+
|
|
66
|
+
return horizontal ? d3Shape.area().defined(defined).curve(interpolationFunction).x0(getY0Accessor(scale)).x1(getYAccessor(scale)).y(getXAccessor(scale)) : d3Shape.area().defined(defined).curve(interpolationFunction).x(getXAccessor(scale)).y1(getYAccessor(scale)).y0(getY0Accessor(scale));
|
|
84
67
|
};
|
|
85
68
|
|
|
86
69
|
var getAreaFunction = function (props) {
|
|
87
70
|
var polar = props.polar,
|
|
88
71
|
scale = props.scale;
|
|
89
|
-
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
return polar ? d3Shape.radialArea().defined(defined).curve(interpolationFunction
|
|
72
|
+
|
|
73
|
+
var interpolationFunction = _victoryCore.LineHelpers.getInterpolationFunction(props);
|
|
74
|
+
|
|
75
|
+
return polar ? d3Shape.radialArea().defined(defined).curve(interpolationFunction).angle(getAngleAccessor(scale)).outerRadius(getYAccessor(scale)).innerRadius(getY0Accessor(scale)) : getCartesianArea(props);
|
|
93
76
|
};
|
|
94
77
|
|
|
95
78
|
var evaluateProps = function (props) {
|
|
@@ -121,6 +104,10 @@ var evaluateProps = function (props) {
|
|
|
121
104
|
tabIndex: tabIndex
|
|
122
105
|
});
|
|
123
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* The area primitive used by VictoryArea
|
|
109
|
+
*/
|
|
110
|
+
|
|
124
111
|
|
|
125
112
|
var Area = function (props) {
|
|
126
113
|
props = evaluateProps(props);
|
|
@@ -147,7 +134,9 @@ var Area = function (props) {
|
|
|
147
134
|
var transform = props.transform || defaultTransform;
|
|
148
135
|
var renderLine = style.stroke && style.stroke !== "none" && style.stroke !== "transparent";
|
|
149
136
|
var areaFunction = getAreaFunction(props);
|
|
150
|
-
|
|
137
|
+
|
|
138
|
+
var lineFunction = renderLine && _victoryCore.LineHelpers.getLineFunction(props);
|
|
139
|
+
|
|
151
140
|
var areaStroke = style.stroke ? "none" : style.fill;
|
|
152
141
|
|
|
153
142
|
var sharedProps = _objectSpread(_objectSpread({
|
|
@@ -181,6 +170,7 @@ var Area = function (props) {
|
|
|
181
170
|
return renderLine ? /*#__PURE__*/_react.default.cloneElement(groupComponent, userProps, [area, line]) : area;
|
|
182
171
|
};
|
|
183
172
|
|
|
173
|
+
exports.Area = Area;
|
|
184
174
|
Area.propTypes = _objectSpread(_objectSpread({}, _victoryCore.CommonProps.primitiveProps), {}, {
|
|
185
175
|
groupComponent: _propTypes.default.element,
|
|
186
176
|
interpolation: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]),
|
|
@@ -192,5 +182,4 @@ Area.defaultProps = {
|
|
|
192
182
|
role: "presentation",
|
|
193
183
|
shapeRendering: "auto"
|
|
194
184
|
};
|
|
195
|
-
|
|
196
|
-
exports.default = _default;
|
|
185
|
+
//# sourceMappingURL=area.js.map
|
package/lib/helper-methods.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
InterpolationPropType,
|
|
5
|
-
StringOrNumberOrCallback,
|
|
6
|
-
VictoryCommonProps,
|
|
7
|
-
VictoryCommonPrimitiveProps,
|
|
8
|
-
VictoryDatableProps,
|
|
9
|
-
VictoryMultiLabelableProps,
|
|
10
|
-
VictoryStyleInterface
|
|
11
|
-
} from "victory-core";
|
|
12
|
-
|
|
13
|
-
export type VictoryAreaTTargetType = "data" | "labels" | "parent";
|
|
14
|
-
|
|
15
|
-
export interface VictoryAreaProps
|
|
16
|
-
extends VictoryCommonProps,
|
|
17
|
-
VictoryDatableProps,
|
|
18
|
-
VictoryMultiLabelableProps {
|
|
19
|
-
eventKey?: string[] | number[] | StringOrNumberOrCallback;
|
|
20
|
-
events?: EventPropTypeInterface<VictoryAreaTTargetType, string | number>[];
|
|
21
|
-
interpolation?: InterpolationPropType | Function;
|
|
22
|
-
samples?: number;
|
|
23
|
-
style?: VictoryStyleInterface;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Draw area charts with React. VictoryArea is a composable component, so it doesn"t include axes.
|
|
28
|
-
* Add VictoryArea as a child of VictoryChart for a complete chart.
|
|
29
|
-
*/
|
|
30
|
-
export class VictoryArea extends React.Component<VictoryAreaProps, any> {}
|
|
31
|
-
|
|
32
|
-
export interface AreaProps extends VictoryCommonPrimitiveProps {
|
|
33
|
-
groupComponent?: React.ReactElement;
|
|
34
|
-
interpolation?: string | Function;
|
|
35
|
-
pathComponent?: React.ReactElement;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The area primitive used by VictoryArea
|
|
40
|
-
*/
|
|
41
|
-
export class Area extends React.Component<AreaProps, any> {}
|
|
1
|
+
export * from "./victory-area";
|
|
2
|
+
export * from "./area";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|