victory-bar 36.7.0 → 36.8.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 +18 -0
- package/dist/victory-bar.js +278 -415
- package/dist/victory-bar.min.js +1 -1
- package/es/bar-helper-methods.d.ts +7 -0
- package/es/bar-helper-methods.js +7 -3
- package/es/bar.d.ts +20 -0
- package/es/bar.js +15 -34
- package/es/geometry-helper-methods.d.ts +91 -0
- package/es/geometry-helper-methods.js +4 -13
- package/es/helper-methods.d.ts +8 -0
- package/es/index.d.ts +6 -73
- package/es/index.js +2 -2
- package/es/path-helper-methods.d.ts +7 -0
- package/es/path-helper-methods.js +2 -2
- package/es/victory-bar.d.ts +129 -0
- package/es/victory-bar.js +24 -42
- package/lib/bar-helper-methods.d.ts +7 -0
- package/lib/bar-helper-methods.js +8 -3
- package/lib/bar.d.ts +20 -0
- package/lib/bar.js +14 -34
- package/lib/geometry-helper-methods.d.ts +91 -0
- package/lib/geometry-helper-methods.js +3 -10
- package/lib/helper-methods.d.ts +8 -0
- package/lib/index.d.ts +6 -73
- package/lib/index.js +39 -17
- package/lib/path-helper-methods.d.ts +7 -0
- package/lib/path-helper-methods.js +2 -2
- package/lib/victory-bar.d.ts +129 -0
- package/lib/victory-bar.js +26 -47
- package/package.json +3 -3
- package/src/{bar-helper-methods.js → bar-helper-methods.ts} +36 -11
- package/src/{bar.js → bar.tsx} +44 -41
- package/src/geometry-helper-methods.ts +103 -0
- package/src/{helper-methods.js → helper-methods.ts} +2 -2
- package/src/{index.js → index.ts} +2 -2
- package/src/{path-helper-methods.js → path-helper-methods.ts} +11 -8
- package/src/{victory-bar.js → victory-bar.tsx} +57 -32
- package/es/v37/victory-bar-v1.d.ts +0 -24
- package/es/v37/victory-bar-v1.js +0 -102
- package/es/v37/victory-bar-v2.d.ts +0 -24
- package/es/v37/victory-bar-v2.js +0 -97
- package/es/v37/victory-bar.stories.d.ts +0 -19
- package/es/v37/victory-bar.stories.js +0 -22
- package/lib/v37/victory-bar-v1.d.ts +0 -24
- package/lib/v37/victory-bar-v1.js +0 -123
- package/lib/v37/victory-bar-v2.d.ts +0 -24
- package/lib/v37/victory-bar-v2.js +0 -114
- package/lib/v37/victory-bar.stories.d.ts +0 -19
- package/lib/v37/victory-bar.stories.js +0 -45
- package/src/geometry-helper-methods.js +0 -113
- package/src/index.d.ts +0 -73
- package/src/v37/victory-bar-v1.tsx +0 -129
- package/src/v37/victory-bar-v2.tsx +0 -96
- package/src/v37/victory-bar.stories.tsx +0 -28
|
@@ -15,10 +15,11 @@ var _victoryCore = require("victory-core");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
+
var DEFAULT_BAR_WIDTH = 8;
|
|
19
|
+
|
|
18
20
|
var getBarWidth = function (barWidth, props) {
|
|
19
21
|
var scale = props.scale,
|
|
20
22
|
data = props.data,
|
|
21
|
-
defaultBarWidth = props.defaultBarWidth,
|
|
22
23
|
style = props.style;
|
|
23
24
|
|
|
24
25
|
if (barWidth) {
|
|
@@ -31,7 +32,7 @@ var getBarWidth = function (barWidth, props) {
|
|
|
31
32
|
var extent = Math.abs(range[1] - range[0]);
|
|
32
33
|
var bars = data.length + 2;
|
|
33
34
|
var barRatio = props.barRatio || 0.5;
|
|
34
|
-
var defaultWidth = barRatio * (data.length < 2 ?
|
|
35
|
+
var defaultWidth = barRatio * (data.length < 2 ? DEFAULT_BAR_WIDTH : extent / bars);
|
|
35
36
|
return Math.max(1, defaultWidth);
|
|
36
37
|
};
|
|
37
38
|
|
|
@@ -60,6 +61,10 @@ var getCornerRadiusFromObject = function (cornerRadius, props) {
|
|
|
60
61
|
return realCornerRadius;
|
|
61
62
|
};
|
|
62
63
|
|
|
64
|
+
function isCornerRadiusObject(cornerRadius) {
|
|
65
|
+
return (0, _isPlainObject2.default)(cornerRadius);
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
var getCornerRadius = function (cornerRadius, props) {
|
|
64
69
|
var realCornerRadius = {
|
|
65
70
|
topLeft: 0,
|
|
@@ -72,7 +77,7 @@ var getCornerRadius = function (cornerRadius, props) {
|
|
|
72
77
|
return realCornerRadius;
|
|
73
78
|
}
|
|
74
79
|
|
|
75
|
-
if ((
|
|
80
|
+
if (isCornerRadiusObject(cornerRadius)) {
|
|
76
81
|
return getCornerRadiusFromObject(cornerRadius, props);
|
|
77
82
|
}
|
|
78
83
|
|
package/lib/bar.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NumberOrCallback, VictoryCommonPrimitiveProps } from "victory-core";
|
|
3
|
+
import { VictoryBarAlignmentType, VictoryBarCornerRadiusObject } from "./victory-bar";
|
|
4
|
+
export interface BarProps extends VictoryCommonPrimitiveProps {
|
|
5
|
+
alignment?: VictoryBarAlignmentType;
|
|
6
|
+
barOffset?: number[];
|
|
7
|
+
barRatio?: number;
|
|
8
|
+
barWidth?: NumberOrCallback;
|
|
9
|
+
cornerRadius?: NumberOrCallback | VictoryBarCornerRadiusObject;
|
|
10
|
+
datum?: any;
|
|
11
|
+
getPath?: (x: number, y: number, props: any) => string;
|
|
12
|
+
horizontal?: boolean;
|
|
13
|
+
pathComponent?: React.ReactElement;
|
|
14
|
+
width?: number;
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
y0?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const Bar: React.ForwardRefExoticComponent<BarProps & React.RefAttributes<SVGPathElement>>;
|
|
20
|
+
//# sourceMappingURL=bar.d.ts.map
|
package/lib/bar.js
CHANGED
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.Bar = void 0;
|
|
7
7
|
|
|
8
8
|
var _assign2 = _interopRequireDefault(require("lodash/assign"));
|
|
9
9
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
11
|
|
|
14
12
|
var _victoryCore = require("victory-core");
|
|
@@ -68,11 +66,16 @@ var evaluateProps = function (props) {
|
|
|
68
66
|
id: id,
|
|
69
67
|
tabIndex: tabIndex
|
|
70
68
|
});
|
|
71
|
-
};
|
|
69
|
+
};
|
|
72
70
|
|
|
71
|
+
var defaultProps = {
|
|
72
|
+
pathComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Path, null),
|
|
73
|
+
role: "presentation",
|
|
74
|
+
shapeRendering: "auto"
|
|
75
|
+
}; // eslint-disable-next-line prefer-arrow-callback
|
|
73
76
|
|
|
74
77
|
var Bar = /*#__PURE__*/(0, _react.forwardRef)(function Bar(props, ref) {
|
|
75
|
-
props = evaluateProps(props);
|
|
78
|
+
props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
|
|
76
79
|
var _props = props,
|
|
77
80
|
polar = _props.polar,
|
|
78
81
|
origin = _props.origin,
|
|
@@ -81,6 +84,11 @@ var Bar = /*#__PURE__*/(0, _react.forwardRef)(function Bar(props, ref) {
|
|
|
81
84
|
cornerRadius = _props.cornerRadius;
|
|
82
85
|
var path = polar ? (0, _pathHelperMethods.getPolarBarPath)(props, cornerRadius) : (0, _pathHelperMethods.getBarPath)(props, barWidth, cornerRadius);
|
|
83
86
|
var defaultTransform = polar && origin ? "translate(".concat(origin.x, ", ").concat(origin.y, ")") : undefined;
|
|
87
|
+
|
|
88
|
+
if (!props.pathComponent) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
return /*#__PURE__*/_react.default.cloneElement(props.pathComponent, _objectSpread(_objectSpread({}, props.events), {}, {
|
|
85
93
|
"aria-label": props.ariaLabel,
|
|
86
94
|
style: style,
|
|
@@ -96,32 +104,4 @@ var Bar = /*#__PURE__*/(0, _react.forwardRef)(function Bar(props, ref) {
|
|
|
96
104
|
ref: ref
|
|
97
105
|
}));
|
|
98
106
|
});
|
|
99
|
-
Bar
|
|
100
|
-
alignment: _propTypes.default.oneOf(["start", "middle", "end"]),
|
|
101
|
-
barRatio: _propTypes.default.number,
|
|
102
|
-
barWidth: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.func]),
|
|
103
|
-
cornerRadius: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.func, _propTypes.default.shape({
|
|
104
|
-
top: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.func]),
|
|
105
|
-
topLeft: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.func]),
|
|
106
|
-
topRight: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.func]),
|
|
107
|
-
bottom: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.func]),
|
|
108
|
-
bottomLeft: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.func]),
|
|
109
|
-
bottomRight: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.func])
|
|
110
|
-
})]),
|
|
111
|
-
datum: _propTypes.default.object,
|
|
112
|
-
getPath: _propTypes.default.func,
|
|
113
|
-
horizontal: _propTypes.default.bool,
|
|
114
|
-
pathComponent: _propTypes.default.element,
|
|
115
|
-
width: _propTypes.default.number,
|
|
116
|
-
x: _propTypes.default.number,
|
|
117
|
-
y: _propTypes.default.number,
|
|
118
|
-
y0: _propTypes.default.number
|
|
119
|
-
});
|
|
120
|
-
Bar.defaultProps = {
|
|
121
|
-
defaultBarWidth: 8,
|
|
122
|
-
pathComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Path, null),
|
|
123
|
-
role: "presentation",
|
|
124
|
-
shapeRendering: "auto"
|
|
125
|
-
};
|
|
126
|
-
var _default = Bar;
|
|
127
|
-
exports.default = _default;
|
|
107
|
+
exports.Bar = Bar;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A point in the 2d plane
|
|
3
|
+
*/
|
|
4
|
+
export declare const point: (x: number, y: number) => {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
distance(p1: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}): number;
|
|
11
|
+
add(p1: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}): any;
|
|
15
|
+
subtract(p1: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}): any;
|
|
19
|
+
scalarMult(n: number): any;
|
|
20
|
+
scalarDivide(n: number): any;
|
|
21
|
+
equals(p1: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
}): boolean;
|
|
25
|
+
};
|
|
26
|
+
declare type Center = ReturnType<typeof point>;
|
|
27
|
+
/**
|
|
28
|
+
* A circle in the 2d plane
|
|
29
|
+
*/
|
|
30
|
+
export declare const circle: (center: Center, radius: number) => {
|
|
31
|
+
center: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
distance(p1: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
}): number;
|
|
38
|
+
add(p1: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
}): any;
|
|
42
|
+
subtract(p1: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
}): any;
|
|
46
|
+
scalarMult(n: number): any;
|
|
47
|
+
scalarDivide(n: number): any;
|
|
48
|
+
equals(p1: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
}): boolean;
|
|
52
|
+
};
|
|
53
|
+
radius: number;
|
|
54
|
+
hasIntersection(circle1: {
|
|
55
|
+
center: Center;
|
|
56
|
+
radius: number;
|
|
57
|
+
}): boolean;
|
|
58
|
+
equals(circle1: {
|
|
59
|
+
center: Center;
|
|
60
|
+
radius: number;
|
|
61
|
+
}): boolean;
|
|
62
|
+
intersection(circle1: {
|
|
63
|
+
center: Center;
|
|
64
|
+
radius: number;
|
|
65
|
+
}): {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
distance(p1: {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
}): number;
|
|
72
|
+
add(p1: {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
}): any;
|
|
76
|
+
subtract(p1: {
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
}): any;
|
|
80
|
+
scalarMult(n: number): any;
|
|
81
|
+
scalarDivide(n: number): any;
|
|
82
|
+
equals(p1: {
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
}): boolean;
|
|
86
|
+
}[];
|
|
87
|
+
solveX(y: number): number[];
|
|
88
|
+
solveY(x: number): number[];
|
|
89
|
+
};
|
|
90
|
+
export {};
|
|
91
|
+
//# sourceMappingURL=geometry-helper-methods.d.ts.map
|
|
@@ -7,9 +7,6 @@ exports.point = exports.circle = void 0;
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A point in the 2d plane
|
|
10
|
-
* @param {number} x - x coordinate
|
|
11
|
-
* @param {number} y - y coordinate
|
|
12
|
-
* @returns {object} - point object
|
|
13
10
|
*/
|
|
14
11
|
var point = function (x, y) {
|
|
15
12
|
return {
|
|
@@ -43,16 +40,12 @@ var point = function (x, y) {
|
|
|
43
40
|
}
|
|
44
41
|
};
|
|
45
42
|
};
|
|
46
|
-
/**
|
|
47
|
-
* A circle in the 2d plane
|
|
48
|
-
* @param {point} center - center of circle
|
|
49
|
-
* @param {number} radius - radius of circle
|
|
50
|
-
* @returns {object} - point object
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
43
|
|
|
54
44
|
exports.point = point;
|
|
55
45
|
|
|
46
|
+
/**
|
|
47
|
+
* A circle in the 2d plane
|
|
48
|
+
*/
|
|
56
49
|
var circle = function (center, radius) {
|
|
57
50
|
return {
|
|
58
51
|
center: center,
|
package/lib/index.d.ts
CHANGED
|
@@ -1,73 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
VictoryCommonPrimitiveProps,
|
|
8
|
-
VictoryDatableProps,
|
|
9
|
-
VictoryMultiLabelableProps,
|
|
10
|
-
VictoryStyleInterface,
|
|
11
|
-
} from "victory-core";
|
|
12
|
-
|
|
13
|
-
export type VictoryBarTTargetType = "data" | "labels" | "parent";
|
|
14
|
-
export type VictoryBarAlignmentType = "start" | "middle" | "end";
|
|
15
|
-
|
|
16
|
-
export interface VictoryBarProps
|
|
17
|
-
extends VictoryCommonProps,
|
|
18
|
-
VictoryDatableProps,
|
|
19
|
-
VictoryMultiLabelableProps {
|
|
20
|
-
alignment?: VictoryBarAlignmentType;
|
|
21
|
-
barRatio?: number;
|
|
22
|
-
barWidth?: NumberOrCallback;
|
|
23
|
-
cornerRadius?:
|
|
24
|
-
| NumberOrCallback
|
|
25
|
-
| {
|
|
26
|
-
top?: NumberOrCallback;
|
|
27
|
-
topLeft?: NumberOrCallback;
|
|
28
|
-
topRight?: NumberOrCallback;
|
|
29
|
-
bottom?: NumberOrCallback;
|
|
30
|
-
bottomLeft?: NumberOrCallback;
|
|
31
|
-
bottomRight?: NumberOrCallback;
|
|
32
|
-
};
|
|
33
|
-
events?: EventPropTypeInterface<
|
|
34
|
-
VictoryBarTTargetType,
|
|
35
|
-
number | string | number[] | string[]
|
|
36
|
-
>[];
|
|
37
|
-
eventKey?: StringOrNumberOrCallback;
|
|
38
|
-
horizontal?: boolean;
|
|
39
|
-
style?: VictoryStyleInterface;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Draw SVG bar charts with React. VictoryBar is a composable component, so it doesn"t include axes
|
|
44
|
-
* Check out VictoryChart for complete bar charts and more.
|
|
45
|
-
*/
|
|
46
|
-
export class VictoryBar extends React.Component<VictoryBarProps, any> {}
|
|
47
|
-
|
|
48
|
-
export interface BarProps extends VictoryCommonPrimitiveProps {
|
|
49
|
-
alignment?: VictoryBarAlignmentType;
|
|
50
|
-
barOffset?: number[];
|
|
51
|
-
barRatio?: number;
|
|
52
|
-
barWidth?: NumberOrCallback;
|
|
53
|
-
cornerRadius?:
|
|
54
|
-
| NumberOrCallback
|
|
55
|
-
| {
|
|
56
|
-
top?: NumberOrCallback;
|
|
57
|
-
topLeft?: NumberOrCallback;
|
|
58
|
-
topRight?: NumberOrCallback;
|
|
59
|
-
bottom?: NumberOrCallback;
|
|
60
|
-
bottomLeft?: NumberOrCallback;
|
|
61
|
-
bottomRight?: NumberOrCallback;
|
|
62
|
-
};
|
|
63
|
-
datum?: any;
|
|
64
|
-
getPath?: Function;
|
|
65
|
-
horizontal?: boolean;
|
|
66
|
-
pathComponent?: React.ReactElement;
|
|
67
|
-
width?: number;
|
|
68
|
-
x?: number;
|
|
69
|
-
y?: number;
|
|
70
|
-
y0?: number;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export class Bar extends React.Component<BarProps, any> {}
|
|
1
|
+
export * from "./victory-bar";
|
|
2
|
+
export * from "./bar";
|
|
3
|
+
export { getBarPosition } from "./helper-methods";
|
|
4
|
+
export { getVerticalBarPath, getHorizontalBarPath, getVerticalPolarBarPath, getCustomBarPath, getPolarBarPath, getBarPath, } from "./path-helper-methods";
|
|
5
|
+
export { getBarWidth, getStyle, getCornerRadius } from "./bar-helper-methods";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
getBarPosition: true,
|
|
8
|
+
getVerticalBarPath: true,
|
|
9
|
+
getHorizontalBarPath: true,
|
|
10
|
+
getVerticalPolarBarPath: true,
|
|
11
|
+
getCustomBarPath: true,
|
|
12
|
+
getPolarBarPath: true,
|
|
13
|
+
getBarPath: true,
|
|
14
|
+
getBarWidth: true,
|
|
15
|
+
getStyle: true,
|
|
16
|
+
getCornerRadius: true
|
|
17
|
+
};
|
|
18
18
|
Object.defineProperty(exports, "getBarPath", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
@@ -76,14 +76,36 @@ Object.defineProperty(exports, "getVerticalPolarBarPath", {
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
var _victoryBar =
|
|
79
|
+
var _victoryBar = require("./victory-bar");
|
|
80
|
+
|
|
81
|
+
Object.keys(_victoryBar).forEach(function (key) {
|
|
82
|
+
if (key === "default" || key === "__esModule") return;
|
|
83
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
84
|
+
if (key in exports && exports[key] === _victoryBar[key]) return;
|
|
85
|
+
Object.defineProperty(exports, key, {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return _victoryBar[key];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
var _bar = require("./bar");
|
|
80
94
|
|
|
81
|
-
|
|
95
|
+
Object.keys(_bar).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
98
|
+
if (key in exports && exports[key] === _bar[key]) return;
|
|
99
|
+
Object.defineProperty(exports, key, {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function () {
|
|
102
|
+
return _bar[key];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
82
106
|
|
|
83
107
|
var _helperMethods = require("./helper-methods");
|
|
84
108
|
|
|
85
109
|
var _pathHelperMethods = require("./path-helper-methods");
|
|
86
110
|
|
|
87
|
-
var _barHelperMethods = require("./bar-helper-methods");
|
|
88
|
-
|
|
89
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
111
|
+
var _barHelperMethods = require("./bar-helper-methods");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getCustomBarPath: (props: any, width: any) => any;
|
|
2
|
+
export declare const getVerticalBarPath: (props: any, width: any, cornerRadius: any) => string;
|
|
3
|
+
export declare const getHorizontalBarPath: (props: any, width: any, cornerRadius: any) => string;
|
|
4
|
+
export declare const getVerticalPolarBarPath: (props: any, cornerRadius: any) => string;
|
|
5
|
+
export declare const getBarPath: (props: any, width: any, cornerRadius: any) => any;
|
|
6
|
+
export declare const getPolarBarPath: (props: any, cornerRadius: any) => string;
|
|
7
|
+
//# sourceMappingURL=path-helper-methods.d.ts.map
|
|
@@ -370,11 +370,11 @@ var getVerticalPolarBarPath = function (props, cornerRadius) {
|
|
|
370
370
|
|
|
371
371
|
var getPathData = function (edge) {
|
|
372
372
|
var rightPath = getPath("".concat(edge, "Right"));
|
|
373
|
-
var rightMoves = rightPath.match(/[A-Z]/g);
|
|
373
|
+
var rightMoves = rightPath.match(/[A-Z]/g) || [];
|
|
374
374
|
var rightCoords = rightPath.split(/[A-Z]/).slice(1);
|
|
375
375
|
var rightMiddle = rightMoves.indexOf("L");
|
|
376
376
|
var leftPath = getPath("".concat(edge, "Left"));
|
|
377
|
-
var leftMoves = leftPath.match(/[A-Z]/g);
|
|
377
|
+
var leftMoves = leftPath.match(/[A-Z]/g) || [];
|
|
378
378
|
var leftCoords = leftPath.split(/[A-Z]/).slice(1);
|
|
379
379
|
var leftMiddle = leftMoves.indexOf("L");
|
|
380
380
|
return {
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Data, Domain, EventPropTypeInterface, NumberOrCallback, StringOrNumberOrCallback, VictoryCommonProps, VictoryDatableProps, VictoryMultiLabelableProps, VictoryStyleInterface, EventsMixinClass } from "victory-core";
|
|
3
|
+
export declare type VictoryBarCornerRadiusKey = "top" | "bottom" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
|
|
4
|
+
export declare type VictoryBarCornerRadiusObject = Partial<Record<VictoryBarCornerRadiusKey, NumberOrCallback>>;
|
|
5
|
+
export declare type VictoryBarTTargetType = "data" | "labels" | "parent";
|
|
6
|
+
export declare type VictoryBarAlignmentType = "start" | "middle" | "end";
|
|
7
|
+
export interface VictoryBarProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabelableProps {
|
|
8
|
+
alignment?: VictoryBarAlignmentType;
|
|
9
|
+
barRatio?: number;
|
|
10
|
+
barWidth?: NumberOrCallback;
|
|
11
|
+
cornerRadius?: NumberOrCallback | VictoryBarCornerRadiusObject;
|
|
12
|
+
events?: EventPropTypeInterface<VictoryBarTTargetType, number | string | number[] | string[]>[];
|
|
13
|
+
eventKey?: StringOrNumberOrCallback;
|
|
14
|
+
horizontal?: boolean;
|
|
15
|
+
style?: VictoryStyleInterface;
|
|
16
|
+
}
|
|
17
|
+
interface VictoryBarBase extends EventsMixinClass<VictoryBarProps> {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Draw SVG bar charts with React. VictoryBar is a composable component, so it doesn"t include axes
|
|
21
|
+
* Check out VictoryChart for complete bar charts and more.
|
|
22
|
+
*/
|
|
23
|
+
declare class VictoryBarBase extends React.Component<VictoryBarProps> {
|
|
24
|
+
static animationWhitelist: (keyof VictoryBarProps)[];
|
|
25
|
+
static displayName: string;
|
|
26
|
+
static role: string;
|
|
27
|
+
static defaultTransitions: {
|
|
28
|
+
onLoad: {
|
|
29
|
+
duration: number;
|
|
30
|
+
before: () => {
|
|
31
|
+
_y: number;
|
|
32
|
+
_y1: number;
|
|
33
|
+
_y0: number;
|
|
34
|
+
};
|
|
35
|
+
after: (datum: any) => {
|
|
36
|
+
_y: any;
|
|
37
|
+
_y1: any;
|
|
38
|
+
_y0: any;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
onExit: {
|
|
42
|
+
duration: number;
|
|
43
|
+
before: () => {
|
|
44
|
+
_y: number;
|
|
45
|
+
yOffset: number;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
onEnter: {
|
|
49
|
+
duration: number;
|
|
50
|
+
before: () => {
|
|
51
|
+
_y: number;
|
|
52
|
+
_y1: number;
|
|
53
|
+
_y0: number;
|
|
54
|
+
};
|
|
55
|
+
after: (datum: any) => {
|
|
56
|
+
_y: any;
|
|
57
|
+
_y1: any;
|
|
58
|
+
_y0: any;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
static defaultProps: VictoryBarProps;
|
|
63
|
+
static getDomain: typeof Domain.getDomainWithZero;
|
|
64
|
+
static getData: typeof Data.getData;
|
|
65
|
+
static getBaseProps: (props: VictoryBarProps) => any;
|
|
66
|
+
static expectedComponents: (keyof VictoryBarProps)[];
|
|
67
|
+
shouldAnimate(): boolean;
|
|
68
|
+
render(): React.ReactElement;
|
|
69
|
+
}
|
|
70
|
+
export declare const VictoryBar: {
|
|
71
|
+
new (props: import("victory-core").EventMixinCommonProps): {
|
|
72
|
+
state: {};
|
|
73
|
+
getEventState: (eventKey: string | number, namespace: string, childType?: string | undefined) => any;
|
|
74
|
+
getScopedEvents: (events: any, namespace: any, childType: any, baseProps: any) => {};
|
|
75
|
+
getEvents: (p: any, target: any, eventKey: any) => any;
|
|
76
|
+
externalMutations: {} | undefined;
|
|
77
|
+
calculatedState: {};
|
|
78
|
+
globalEvents: {};
|
|
79
|
+
prevGlobalEventKeys: string[];
|
|
80
|
+
boundGlobalEvents: {};
|
|
81
|
+
shouldComponentUpdate(nextProps: import("victory-core").EventMixinCommonProps): boolean;
|
|
82
|
+
componentDidMount(): void;
|
|
83
|
+
componentDidUpdate(prevProps: any): void;
|
|
84
|
+
componentWillUnmount(): void;
|
|
85
|
+
addGlobalListener(key: any): void;
|
|
86
|
+
removeGlobalListener(key: any): void;
|
|
87
|
+
getStateChanges(props: any): {};
|
|
88
|
+
applyExternalMutations(props: any, externalMutations: any): void;
|
|
89
|
+
getCalculatedValues(props: any): import("victory-core").EventMixinCalculatedValues;
|
|
90
|
+
getExternalMutations(props: import("victory-core").EventMixinCommonProps): {} | undefined;
|
|
91
|
+
cacheValues(obj: any): void;
|
|
92
|
+
getBaseProps(props: any, getSharedEventState: any): Record<string, object>;
|
|
93
|
+
getAllEvents(props: any): any;
|
|
94
|
+
getComponentProps(component: React.ReactNode, type: string, index: string | number): any;
|
|
95
|
+
renderContainer(component: any, children: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
96
|
+
animateComponent(props: import("victory-core").EventMixinCommonProps, defaultAnimationWhitelist: string[]): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
97
|
+
renderContinuousData(props: import("victory-core").EventMixinCommonProps): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
98
|
+
renderData(props: any, shouldRenderDatum?: ((datum: any) => boolean) | undefined): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
99
|
+
context: unknown;
|
|
100
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("victory-core").EventMixinCommonProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
101
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
102
|
+
render(): React.ReactNode;
|
|
103
|
+
readonly props: Readonly<import("victory-core").EventMixinCommonProps>;
|
|
104
|
+
refs: {
|
|
105
|
+
[key: string]: React.ReactInstance;
|
|
106
|
+
};
|
|
107
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
108
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<import("victory-core").EventMixinCommonProps>, prevState: Readonly<{}>): any;
|
|
109
|
+
componentWillMount?(): void;
|
|
110
|
+
UNSAFE_componentWillMount?(): void;
|
|
111
|
+
componentWillReceiveProps?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextContext: any): void;
|
|
112
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextContext: any): void;
|
|
113
|
+
componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
114
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
115
|
+
componentEvents: import("victory-core/lib/victory-util/events").ComponentEvent[];
|
|
116
|
+
getSharedEventState: (key: string, value: string) => unknown;
|
|
117
|
+
baseProps: Record<string, object>;
|
|
118
|
+
dataKeys: string[];
|
|
119
|
+
hasEvents: unknown;
|
|
120
|
+
events: unknown;
|
|
121
|
+
};
|
|
122
|
+
getBaseProps?(props: import("victory-core").EventMixinCommonProps): Record<string, object>;
|
|
123
|
+
role?: string | undefined;
|
|
124
|
+
expectedComponents?: string[] | undefined;
|
|
125
|
+
getChildren?: ((props: import("victory-core").EventMixinCommonProps, childComponents?: React.ReactNode[] | undefined, calculatedProps?: import("victory-core").EventMixinCommonProps | undefined) => void) | undefined;
|
|
126
|
+
animationWhitelist?: string[] | undefined;
|
|
127
|
+
} & typeof VictoryBarBase;
|
|
128
|
+
export {};
|
|
129
|
+
//# sourceMappingURL=victory-bar.d.ts.map
|