victory-chart 36.7.0 → 36.8.1
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 +14 -0
- package/dist/victory-chart.js +365 -290
- package/dist/victory-chart.min.js +1 -1
- package/es/helper-methods.js +4 -18
- package/es/victory-chart.js +20 -19
- package/lib/helper-methods.js +5 -18
- package/lib/victory-chart.js +20 -19
- package/package.json +5 -5
- package/src/helper-methods.tsx +7 -8
- package/src/victory-chart.tsx +17 -16
- package/es/v37/victory-chart.d.ts +0 -25
- package/es/v37/victory-chart.js +0 -55
- package/lib/v37/victory-chart.d.ts +0 -25
- package/lib/v37/victory-chart.js +0 -71
- package/src/v37/victory-chart.tsx +0 -91
package/es/helper-methods.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import _assign from "lodash/assign";
|
|
2
2
|
import _defaults from "lodash/defaults";
|
|
3
3
|
|
|
4
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
|
-
|
|
6
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
-
|
|
8
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
-
|
|
10
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
|
-
|
|
12
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
-
|
|
14
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
15
|
-
|
|
16
4
|
/* eslint-disable no-use-before-define */
|
|
17
5
|
import React from "react";
|
|
18
6
|
import { Helpers, Scale, Axis, Wrapper } from "victory-core";
|
|
@@ -151,7 +139,7 @@ export function getChildren(props, childComponents, calculatedProps) {
|
|
|
151
139
|
origin = _calculatedProps.origin,
|
|
152
140
|
horizontal = _calculatedProps.horizontal;
|
|
153
141
|
var parentName = props.name || "chart";
|
|
154
|
-
return childComponents.map(function (child, index) {
|
|
142
|
+
return childComponents.filter(React.isValidElement).map(function (child, index) {
|
|
155
143
|
var role = child.type && child.type.role;
|
|
156
144
|
var style = Array.isArray(child.props.style) ? child.props.style : _defaults({}, child.props.style, {
|
|
157
145
|
parent: baseStyle
|
|
@@ -179,10 +167,8 @@ export function getChildren(props, childComponents, calculatedProps) {
|
|
|
179
167
|
export var getChildComponents = function (props, defaultAxes) {
|
|
180
168
|
var childComponents = React.Children.toArray(props.children);
|
|
181
169
|
|
|
182
|
-
var newChildComponents = _toConsumableArray(childComponents);
|
|
183
|
-
|
|
184
170
|
if (childComponents.length === 0) {
|
|
185
|
-
|
|
171
|
+
childComponents.push(defaultAxes.independent, defaultAxes.dependent);
|
|
186
172
|
} else {
|
|
187
173
|
var axisComponents = {
|
|
188
174
|
dependent: Axis.getAxisComponentsWithParent(childComponents, "dependent"),
|
|
@@ -190,11 +176,11 @@ export var getChildComponents = function (props, defaultAxes) {
|
|
|
190
176
|
};
|
|
191
177
|
|
|
192
178
|
if (axisComponents.dependent.length === 0 && axisComponents.independent.length === 0) {
|
|
193
|
-
|
|
179
|
+
childComponents = props.prependDefaultAxes ? [defaultAxes.independent, defaultAxes.dependent].concat(childComponents) : childComponents.concat([defaultAxes.independent, defaultAxes.dependent]);
|
|
194
180
|
}
|
|
195
181
|
}
|
|
196
182
|
|
|
197
|
-
return
|
|
183
|
+
return childComponents;
|
|
198
184
|
};
|
|
199
185
|
|
|
200
186
|
var getDomain = function (props, axis, childComponents) {
|
package/es/victory-chart.js
CHANGED
|
@@ -21,8 +21,28 @@ var fallbackProps = {
|
|
|
21
21
|
height: 300,
|
|
22
22
|
padding: 50
|
|
23
23
|
};
|
|
24
|
+
var defaultProps = {
|
|
25
|
+
backgroundComponent: /*#__PURE__*/React.createElement(Background, null),
|
|
26
|
+
containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
|
|
27
|
+
defaultAxes: {
|
|
28
|
+
independent: /*#__PURE__*/React.createElement(VictoryAxis, null),
|
|
29
|
+
dependent: /*#__PURE__*/React.createElement(VictoryAxis, {
|
|
30
|
+
dependentAxis: true
|
|
31
|
+
})
|
|
32
|
+
},
|
|
33
|
+
defaultPolarAxes: {
|
|
34
|
+
independent: /*#__PURE__*/React.createElement(VictoryPolarAxis, null),
|
|
35
|
+
dependent: /*#__PURE__*/React.createElement(VictoryPolarAxis, {
|
|
36
|
+
dependentAxis: true
|
|
37
|
+
})
|
|
38
|
+
},
|
|
39
|
+
groupComponent: /*#__PURE__*/React.createElement("g", null),
|
|
40
|
+
standalone: true,
|
|
41
|
+
theme: VictoryTheme.grayscale
|
|
42
|
+
};
|
|
24
43
|
|
|
25
44
|
var VictoryChartImpl = function (initialProps) {
|
|
45
|
+
initialProps = _objectSpread(_objectSpread({}, defaultProps), initialProps);
|
|
26
46
|
var role = "chart";
|
|
27
47
|
|
|
28
48
|
var _Hooks$useAnimationSt = Hooks.useAnimationState(),
|
|
@@ -144,25 +164,6 @@ VictoryChartImpl.propTypes = _objectSpread(_objectSpread({}, CommonProps.basePro
|
|
|
144
164
|
prependDefaultAxes: PropTypes.bool,
|
|
145
165
|
startAngle: PropTypes.number
|
|
146
166
|
});
|
|
147
|
-
VictoryChartImpl.defaultProps = {
|
|
148
|
-
backgroundComponent: /*#__PURE__*/React.createElement(Background, null),
|
|
149
|
-
containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
|
|
150
|
-
defaultAxes: {
|
|
151
|
-
independent: /*#__PURE__*/React.createElement(VictoryAxis, null),
|
|
152
|
-
dependent: /*#__PURE__*/React.createElement(VictoryAxis, {
|
|
153
|
-
dependentAxis: true
|
|
154
|
-
})
|
|
155
|
-
},
|
|
156
|
-
defaultPolarAxes: {
|
|
157
|
-
independent: /*#__PURE__*/React.createElement(VictoryPolarAxis, null),
|
|
158
|
-
dependent: /*#__PURE__*/React.createElement(VictoryPolarAxis, {
|
|
159
|
-
dependentAxis: true
|
|
160
|
-
})
|
|
161
|
-
},
|
|
162
|
-
groupComponent: /*#__PURE__*/React.createElement("g", null),
|
|
163
|
-
standalone: true,
|
|
164
|
-
theme: VictoryTheme.grayscale
|
|
165
|
-
};
|
|
166
167
|
export var VictoryChart = /*#__PURE__*/React.memo(VictoryChartImpl, isEqual);
|
|
167
168
|
VictoryChart.displayName = "VictoryChart"; // @ts-expect-error FIXME: Does this "expectedComponents" do anything?
|
|
168
169
|
|
package/lib/helper-methods.js
CHANGED
|
@@ -18,18 +18,7 @@ var _victoryCore = require("victory-core");
|
|
|
18
18
|
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
-
|
|
25
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
26
|
-
|
|
27
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
28
|
-
|
|
29
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
30
|
-
|
|
31
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
32
|
-
|
|
21
|
+
/* eslint-disable no-use-before-define */
|
|
33
22
|
var fallbackProps = {
|
|
34
23
|
width: 450,
|
|
35
24
|
height: 300,
|
|
@@ -171,7 +160,7 @@ function getChildren(props, childComponents, calculatedProps) {
|
|
|
171
160
|
origin = _calculatedProps.origin,
|
|
172
161
|
horizontal = _calculatedProps.horizontal;
|
|
173
162
|
var parentName = props.name || "chart";
|
|
174
|
-
return childComponents.map(function (child, index) {
|
|
163
|
+
return childComponents.filter(_react.default.isValidElement).map(function (child, index) {
|
|
175
164
|
var role = child.type && child.type.role;
|
|
176
165
|
var style = Array.isArray(child.props.style) ? child.props.style : (0, _defaults2.default)({}, child.props.style, {
|
|
177
166
|
parent: baseStyle
|
|
@@ -198,10 +187,8 @@ function getChildren(props, childComponents, calculatedProps) {
|
|
|
198
187
|
var getChildComponents = function (props, defaultAxes) {
|
|
199
188
|
var childComponents = _react.default.Children.toArray(props.children);
|
|
200
189
|
|
|
201
|
-
var newChildComponents = _toConsumableArray(childComponents);
|
|
202
|
-
|
|
203
190
|
if (childComponents.length === 0) {
|
|
204
|
-
|
|
191
|
+
childComponents.push(defaultAxes.independent, defaultAxes.dependent);
|
|
205
192
|
} else {
|
|
206
193
|
var axisComponents = {
|
|
207
194
|
dependent: _victoryCore.Axis.getAxisComponentsWithParent(childComponents, "dependent"),
|
|
@@ -209,11 +196,11 @@ var getChildComponents = function (props, defaultAxes) {
|
|
|
209
196
|
};
|
|
210
197
|
|
|
211
198
|
if (axisComponents.dependent.length === 0 && axisComponents.independent.length === 0) {
|
|
212
|
-
|
|
199
|
+
childComponents = props.prependDefaultAxes ? [defaultAxes.independent, defaultAxes.dependent].concat(childComponents) : childComponents.concat([defaultAxes.independent, defaultAxes.dependent]);
|
|
213
200
|
}
|
|
214
201
|
}
|
|
215
202
|
|
|
216
|
-
return
|
|
203
|
+
return childComponents;
|
|
217
204
|
};
|
|
218
205
|
|
|
219
206
|
exports.getChildComponents = getChildComponents;
|
package/lib/victory-chart.js
CHANGED
|
@@ -40,8 +40,28 @@ var fallbackProps = {
|
|
|
40
40
|
height: 300,
|
|
41
41
|
padding: 50
|
|
42
42
|
};
|
|
43
|
+
var defaultProps = {
|
|
44
|
+
backgroundComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Background, null),
|
|
45
|
+
containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
|
|
46
|
+
defaultAxes: {
|
|
47
|
+
independent: /*#__PURE__*/_react.default.createElement(_victoryAxis.VictoryAxis, null),
|
|
48
|
+
dependent: /*#__PURE__*/_react.default.createElement(_victoryAxis.VictoryAxis, {
|
|
49
|
+
dependentAxis: true
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
defaultPolarAxes: {
|
|
53
|
+
independent: /*#__PURE__*/_react.default.createElement(_victoryPolarAxis.VictoryPolarAxis, null),
|
|
54
|
+
dependent: /*#__PURE__*/_react.default.createElement(_victoryPolarAxis.VictoryPolarAxis, {
|
|
55
|
+
dependentAxis: true
|
|
56
|
+
})
|
|
57
|
+
},
|
|
58
|
+
groupComponent: /*#__PURE__*/_react.default.createElement("g", null),
|
|
59
|
+
standalone: true,
|
|
60
|
+
theme: _victoryCore.VictoryTheme.grayscale
|
|
61
|
+
};
|
|
43
62
|
|
|
44
63
|
var VictoryChartImpl = function (initialProps) {
|
|
64
|
+
initialProps = _objectSpread(_objectSpread({}, defaultProps), initialProps);
|
|
45
65
|
var role = "chart";
|
|
46
66
|
|
|
47
67
|
var _Hooks$useAnimationSt = _victoryCore.Hooks.useAnimationState(),
|
|
@@ -172,25 +192,6 @@ VictoryChartImpl.propTypes = _objectSpread(_objectSpread({}, _victoryCore.Common
|
|
|
172
192
|
prependDefaultAxes: _propTypes.default.bool,
|
|
173
193
|
startAngle: _propTypes.default.number
|
|
174
194
|
});
|
|
175
|
-
VictoryChartImpl.defaultProps = {
|
|
176
|
-
backgroundComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Background, null),
|
|
177
|
-
containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
|
|
178
|
-
defaultAxes: {
|
|
179
|
-
independent: /*#__PURE__*/_react.default.createElement(_victoryAxis.VictoryAxis, null),
|
|
180
|
-
dependent: /*#__PURE__*/_react.default.createElement(_victoryAxis.VictoryAxis, {
|
|
181
|
-
dependentAxis: true
|
|
182
|
-
})
|
|
183
|
-
},
|
|
184
|
-
defaultPolarAxes: {
|
|
185
|
-
independent: /*#__PURE__*/_react.default.createElement(_victoryPolarAxis.VictoryPolarAxis, null),
|
|
186
|
-
dependent: /*#__PURE__*/_react.default.createElement(_victoryPolarAxis.VictoryPolarAxis, {
|
|
187
|
-
dependentAxis: true
|
|
188
|
-
})
|
|
189
|
-
},
|
|
190
|
-
groupComponent: /*#__PURE__*/_react.default.createElement("g", null),
|
|
191
|
-
standalone: true,
|
|
192
|
-
theme: _victoryCore.VictoryTheme.grayscale
|
|
193
|
-
};
|
|
194
195
|
|
|
195
196
|
var VictoryChart = /*#__PURE__*/_react.default.memo(VictoryChartImpl, _reactFastCompare.default);
|
|
196
197
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-chart",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.8.1",
|
|
4
4
|
"description": "Chart Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"lodash": "^4.17.19",
|
|
24
24
|
"prop-types": "^15.8.1",
|
|
25
25
|
"react-fast-compare": "^3.2.0",
|
|
26
|
-
"victory-axis": "^36.
|
|
27
|
-
"victory-core": "^36.
|
|
28
|
-
"victory-polar-axis": "^36.
|
|
29
|
-
"victory-shared-events": "^36.
|
|
26
|
+
"victory-axis": "^36.8.1",
|
|
27
|
+
"victory-core": "^36.8.1",
|
|
28
|
+
"victory-polar-axis": "^36.8.1",
|
|
29
|
+
"victory-shared-events": "^36.8.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=16.6.0"
|
package/src/helper-methods.tsx
CHANGED
|
@@ -133,7 +133,7 @@ export function getChildren(props, childComponents, calculatedProps) {
|
|
|
133
133
|
const { origin, horizontal } = calculatedProps;
|
|
134
134
|
const parentName = props.name || "chart";
|
|
135
135
|
|
|
136
|
-
return childComponents.map((child, index) => {
|
|
136
|
+
return childComponents.filter(React.isValidElement).map((child, index) => {
|
|
137
137
|
const role = child.type && child.type.role;
|
|
138
138
|
const style = Array.isArray(child.props.style)
|
|
139
139
|
? child.props.style
|
|
@@ -161,11 +161,10 @@ export function getChildren(props, childComponents, calculatedProps) {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
export const getChildComponents = (props, defaultAxes?) => {
|
|
164
|
-
|
|
165
|
-
let newChildComponents = [...childComponents];
|
|
164
|
+
let childComponents = React.Children.toArray(props.children);
|
|
166
165
|
|
|
167
166
|
if (childComponents.length === 0) {
|
|
168
|
-
|
|
167
|
+
childComponents.push(defaultAxes.independent, defaultAxes.dependent);
|
|
169
168
|
} else {
|
|
170
169
|
const axisComponents = {
|
|
171
170
|
dependent: Axis.getAxisComponentsWithParent(childComponents, "dependent"),
|
|
@@ -179,18 +178,18 @@ export const getChildComponents = (props, defaultAxes?) => {
|
|
|
179
178
|
axisComponents.dependent.length === 0 &&
|
|
180
179
|
axisComponents.independent.length === 0
|
|
181
180
|
) {
|
|
182
|
-
|
|
181
|
+
childComponents = props.prependDefaultAxes
|
|
183
182
|
? [defaultAxes.independent, defaultAxes.dependent].concat(
|
|
184
|
-
|
|
183
|
+
childComponents,
|
|
185
184
|
)
|
|
186
|
-
:
|
|
185
|
+
: childComponents.concat([
|
|
187
186
|
defaultAxes.independent,
|
|
188
187
|
defaultAxes.dependent,
|
|
189
188
|
]);
|
|
190
189
|
}
|
|
191
190
|
}
|
|
192
191
|
|
|
193
|
-
return
|
|
192
|
+
return childComponents;
|
|
194
193
|
};
|
|
195
194
|
|
|
196
195
|
const getDomain = (props, axis, childComponents) => {
|
package/src/victory-chart.tsx
CHANGED
|
@@ -36,7 +36,24 @@ const fallbackProps = {
|
|
|
36
36
|
padding: 50,
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
const defaultProps = {
|
|
40
|
+
backgroundComponent: <Background />,
|
|
41
|
+
containerComponent: <VictoryContainer />,
|
|
42
|
+
defaultAxes: {
|
|
43
|
+
independent: <VictoryAxis />,
|
|
44
|
+
dependent: <VictoryAxis dependentAxis />,
|
|
45
|
+
},
|
|
46
|
+
defaultPolarAxes: {
|
|
47
|
+
independent: <VictoryPolarAxis />,
|
|
48
|
+
dependent: <VictoryPolarAxis dependentAxis />,
|
|
49
|
+
},
|
|
50
|
+
groupComponent: <g />,
|
|
51
|
+
standalone: true,
|
|
52
|
+
theme: VictoryTheme.grayscale,
|
|
53
|
+
};
|
|
54
|
+
|
|
39
55
|
const VictoryChartImpl: React.FC<VictoryChartProps> = (initialProps) => {
|
|
56
|
+
initialProps = { ...defaultProps, ...initialProps };
|
|
40
57
|
const role = "chart";
|
|
41
58
|
const { getAnimationProps, setAnimationState, getProps } =
|
|
42
59
|
Hooks.useAnimationState();
|
|
@@ -201,22 +218,6 @@ VictoryChartImpl.propTypes = {
|
|
|
201
218
|
startAngle: PropTypes.number,
|
|
202
219
|
};
|
|
203
220
|
|
|
204
|
-
VictoryChartImpl.defaultProps = {
|
|
205
|
-
backgroundComponent: <Background />,
|
|
206
|
-
containerComponent: <VictoryContainer />,
|
|
207
|
-
defaultAxes: {
|
|
208
|
-
independent: <VictoryAxis />,
|
|
209
|
-
dependent: <VictoryAxis dependentAxis />,
|
|
210
|
-
},
|
|
211
|
-
defaultPolarAxes: {
|
|
212
|
-
independent: <VictoryPolarAxis />,
|
|
213
|
-
dependent: <VictoryPolarAxis dependentAxis />,
|
|
214
|
-
},
|
|
215
|
-
groupComponent: <g />,
|
|
216
|
-
standalone: true,
|
|
217
|
-
theme: VictoryTheme.grayscale,
|
|
218
|
-
};
|
|
219
|
-
|
|
220
221
|
export const VictoryChart = React.memo(VictoryChartImpl, isEqual);
|
|
221
222
|
|
|
222
223
|
VictoryChart.displayName = "VictoryChart";
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryStyleInterface, VictoryStyleObject } from "victory-core";
|
|
3
|
-
import { AxesType } from "..";
|
|
4
|
-
interface VictoryChartProps extends VictoryCommonProps {
|
|
5
|
-
backgroundComponent?: React.ReactElement;
|
|
6
|
-
categories?: CategoryPropType;
|
|
7
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
8
|
-
desc?: string;
|
|
9
|
-
defaultAxes?: AxesType;
|
|
10
|
-
defaultPolarAxes?: AxesType;
|
|
11
|
-
domain?: DomainPropType;
|
|
12
|
-
endAngle?: number;
|
|
13
|
-
eventKey?: StringOrNumberOrCallback;
|
|
14
|
-
events?: EventPropTypeInterface<string, string[] | number[] | string | number>[];
|
|
15
|
-
innerRadius?: number;
|
|
16
|
-
prependDefaultAxes?: boolean;
|
|
17
|
-
startAngle?: number;
|
|
18
|
-
style?: Pick<VictoryStyleInterface, "parent"> & {
|
|
19
|
-
background?: VictoryStyleObject;
|
|
20
|
-
};
|
|
21
|
-
title?: string;
|
|
22
|
-
}
|
|
23
|
-
declare const _default: React.FC<VictoryChartProps>;
|
|
24
|
-
export default _default;
|
|
25
|
-
//# sourceMappingURL=victory-chart.d.ts.map
|
package/es/v37/victory-chart.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
import * as React from "react";
|
|
8
|
-
import { withContainer, useDomain, useScale, useData } from "victory-core/es/v37";
|
|
9
|
-
import { VictoryAxis } from "victory-axis";
|
|
10
|
-
var DEFAULT_AXES = {
|
|
11
|
-
independent: /*#__PURE__*/React.createElement(VictoryAxis, null),
|
|
12
|
-
dependent: /*#__PURE__*/React.createElement(VictoryAxis, {
|
|
13
|
-
dependentAxis: true
|
|
14
|
-
})
|
|
15
|
-
}; // TODO: This does not accept data
|
|
16
|
-
|
|
17
|
-
var VictoryChart = function (_ref) {
|
|
18
|
-
var _ref$defaultAxes = _ref.defaultAxes,
|
|
19
|
-
defaultAxes = _ref$defaultAxes === void 0 ? DEFAULT_AXES : _ref$defaultAxes,
|
|
20
|
-
_ref$groupComponent = _ref.groupComponent,
|
|
21
|
-
groupComponent = _ref$groupComponent === void 0 ? /*#__PURE__*/React.createElement("g", null) : _ref$groupComponent,
|
|
22
|
-
children = _ref.children;
|
|
23
|
-
var scale = useScale();
|
|
24
|
-
var data = useData();
|
|
25
|
-
var domain = useDomain();
|
|
26
|
-
var axes = React.useMemo(function () {
|
|
27
|
-
var _defaultAxes$DEFAULT_ = _objectSpread(_objectSpread({}, defaultAxes), DEFAULT_AXES),
|
|
28
|
-
dependent = _defaultAxes$DEFAULT_.dependent,
|
|
29
|
-
independent = _defaultAxes$DEFAULT_.independent;
|
|
30
|
-
|
|
31
|
-
var axisProps = {
|
|
32
|
-
data: data,
|
|
33
|
-
domain: domain,
|
|
34
|
-
// @ts-expect-error we need to fix this scale type
|
|
35
|
-
scale: scale,
|
|
36
|
-
standalone: false
|
|
37
|
-
};
|
|
38
|
-
return [/*#__PURE__*/React.cloneElement(dependent, _objectSpread(_objectSpread({}, axisProps), {}, {
|
|
39
|
-
key: "dependent-axis"
|
|
40
|
-
})), /*#__PURE__*/React.cloneElement(independent, _objectSpread(_objectSpread({}, axisProps), {}, {
|
|
41
|
-
key: "independent-axis"
|
|
42
|
-
}))];
|
|
43
|
-
}, [defaultAxes, domain, scale, data]);
|
|
44
|
-
var childComponents = React.Children.map(children, function (child, index) {
|
|
45
|
-
// @ts-expect-error Why is this throwing a type error?
|
|
46
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
47
|
-
key: "child-".concat(index),
|
|
48
|
-
index: index,
|
|
49
|
-
standalone: false
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
return /*#__PURE__*/React.cloneElement(groupComponent, {}, axes, childComponents);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default withContainer(VictoryChart);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryStyleInterface, VictoryStyleObject } from "victory-core";
|
|
3
|
-
import { AxesType } from "..";
|
|
4
|
-
interface VictoryChartProps extends VictoryCommonProps {
|
|
5
|
-
backgroundComponent?: React.ReactElement;
|
|
6
|
-
categories?: CategoryPropType;
|
|
7
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
8
|
-
desc?: string;
|
|
9
|
-
defaultAxes?: AxesType;
|
|
10
|
-
defaultPolarAxes?: AxesType;
|
|
11
|
-
domain?: DomainPropType;
|
|
12
|
-
endAngle?: number;
|
|
13
|
-
eventKey?: StringOrNumberOrCallback;
|
|
14
|
-
events?: EventPropTypeInterface<string, string[] | number[] | string | number>[];
|
|
15
|
-
innerRadius?: number;
|
|
16
|
-
prependDefaultAxes?: boolean;
|
|
17
|
-
startAngle?: number;
|
|
18
|
-
style?: Pick<VictoryStyleInterface, "parent"> & {
|
|
19
|
-
background?: VictoryStyleObject;
|
|
20
|
-
};
|
|
21
|
-
title?: string;
|
|
22
|
-
}
|
|
23
|
-
declare const _default: React.FC<VictoryChartProps>;
|
|
24
|
-
export default _default;
|
|
25
|
-
//# sourceMappingURL=victory-chart.d.ts.map
|
package/lib/v37/victory-chart.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _v = require("victory-core/es/v37");
|
|
11
|
-
|
|
12
|
-
var _victoryAxis = require("victory-axis");
|
|
13
|
-
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
var DEFAULT_AXES = {
|
|
25
|
-
independent: /*#__PURE__*/React.createElement(_victoryAxis.VictoryAxis, null),
|
|
26
|
-
dependent: /*#__PURE__*/React.createElement(_victoryAxis.VictoryAxis, {
|
|
27
|
-
dependentAxis: true
|
|
28
|
-
})
|
|
29
|
-
}; // TODO: This does not accept data
|
|
30
|
-
|
|
31
|
-
var VictoryChart = function (_ref) {
|
|
32
|
-
var _ref$defaultAxes = _ref.defaultAxes,
|
|
33
|
-
defaultAxes = _ref$defaultAxes === void 0 ? DEFAULT_AXES : _ref$defaultAxes,
|
|
34
|
-
_ref$groupComponent = _ref.groupComponent,
|
|
35
|
-
groupComponent = _ref$groupComponent === void 0 ? /*#__PURE__*/React.createElement("g", null) : _ref$groupComponent,
|
|
36
|
-
children = _ref.children;
|
|
37
|
-
var scale = (0, _v.useScale)();
|
|
38
|
-
var data = (0, _v.useData)();
|
|
39
|
-
var domain = (0, _v.useDomain)();
|
|
40
|
-
var axes = React.useMemo(function () {
|
|
41
|
-
var _defaultAxes$DEFAULT_ = _objectSpread(_objectSpread({}, defaultAxes), DEFAULT_AXES),
|
|
42
|
-
dependent = _defaultAxes$DEFAULT_.dependent,
|
|
43
|
-
independent = _defaultAxes$DEFAULT_.independent;
|
|
44
|
-
|
|
45
|
-
var axisProps = {
|
|
46
|
-
data: data,
|
|
47
|
-
domain: domain,
|
|
48
|
-
// @ts-expect-error we need to fix this scale type
|
|
49
|
-
scale: scale,
|
|
50
|
-
standalone: false
|
|
51
|
-
};
|
|
52
|
-
return [/*#__PURE__*/React.cloneElement(dependent, _objectSpread(_objectSpread({}, axisProps), {}, {
|
|
53
|
-
key: "dependent-axis"
|
|
54
|
-
})), /*#__PURE__*/React.cloneElement(independent, _objectSpread(_objectSpread({}, axisProps), {}, {
|
|
55
|
-
key: "independent-axis"
|
|
56
|
-
}))];
|
|
57
|
-
}, [defaultAxes, domain, scale, data]);
|
|
58
|
-
var childComponents = React.Children.map(children, function (child, index) {
|
|
59
|
-
// @ts-expect-error Why is this throwing a type error?
|
|
60
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
61
|
-
key: "child-".concat(index),
|
|
62
|
-
index: index,
|
|
63
|
-
standalone: false
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
return /*#__PURE__*/React.cloneElement(groupComponent, {}, axes, childComponents);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
var _default = (0, _v.withContainer)(VictoryChart);
|
|
70
|
-
|
|
71
|
-
exports.default = _default;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
CategoryPropType,
|
|
4
|
-
DomainPropType,
|
|
5
|
-
EventPropTypeInterface,
|
|
6
|
-
StringOrNumberOrCallback,
|
|
7
|
-
VictoryCommonProps,
|
|
8
|
-
VictoryStyleInterface,
|
|
9
|
-
VictoryStyleObject,
|
|
10
|
-
} from "victory-core";
|
|
11
|
-
import {
|
|
12
|
-
withContainer,
|
|
13
|
-
useDomain,
|
|
14
|
-
useScale,
|
|
15
|
-
useData,
|
|
16
|
-
} from "victory-core/es/v37";
|
|
17
|
-
import { AxesType } from "..";
|
|
18
|
-
import { VictoryAxis, VictoryAxisProps } from "victory-axis";
|
|
19
|
-
|
|
20
|
-
interface VictoryChartProps extends VictoryCommonProps {
|
|
21
|
-
backgroundComponent?: React.ReactElement;
|
|
22
|
-
categories?: CategoryPropType;
|
|
23
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
24
|
-
desc?: string;
|
|
25
|
-
defaultAxes?: AxesType;
|
|
26
|
-
defaultPolarAxes?: AxesType;
|
|
27
|
-
domain?: DomainPropType;
|
|
28
|
-
endAngle?: number;
|
|
29
|
-
eventKey?: StringOrNumberOrCallback;
|
|
30
|
-
events?: EventPropTypeInterface<
|
|
31
|
-
string,
|
|
32
|
-
string[] | number[] | string | number
|
|
33
|
-
>[];
|
|
34
|
-
innerRadius?: number;
|
|
35
|
-
prependDefaultAxes?: boolean;
|
|
36
|
-
startAngle?: number;
|
|
37
|
-
style?: Pick<VictoryStyleInterface, "parent"> & {
|
|
38
|
-
background?: VictoryStyleObject;
|
|
39
|
-
};
|
|
40
|
-
title?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const DEFAULT_AXES = {
|
|
44
|
-
independent: <VictoryAxis />,
|
|
45
|
-
dependent: <VictoryAxis dependentAxis />,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// TODO: This does not accept data
|
|
49
|
-
const VictoryChart = ({
|
|
50
|
-
defaultAxes = DEFAULT_AXES,
|
|
51
|
-
groupComponent = <g />,
|
|
52
|
-
children,
|
|
53
|
-
}: VictoryChartProps) => {
|
|
54
|
-
const scale = useScale();
|
|
55
|
-
const data = useData();
|
|
56
|
-
const domain = useDomain();
|
|
57
|
-
|
|
58
|
-
const axes = React.useMemo(() => {
|
|
59
|
-
const { dependent, independent } = {
|
|
60
|
-
...defaultAxes,
|
|
61
|
-
...DEFAULT_AXES,
|
|
62
|
-
};
|
|
63
|
-
const axisProps: VictoryAxisProps = {
|
|
64
|
-
data,
|
|
65
|
-
domain,
|
|
66
|
-
// @ts-expect-error we need to fix this scale type
|
|
67
|
-
scale,
|
|
68
|
-
standalone: false,
|
|
69
|
-
};
|
|
70
|
-
return [
|
|
71
|
-
React.cloneElement(dependent, { ...axisProps, key: "dependent-axis" }),
|
|
72
|
-
React.cloneElement(independent, {
|
|
73
|
-
...axisProps,
|
|
74
|
-
key: "independent-axis",
|
|
75
|
-
}),
|
|
76
|
-
];
|
|
77
|
-
}, [defaultAxes, domain, scale, data]);
|
|
78
|
-
|
|
79
|
-
const childComponents = React.Children.map(children, (child, index) => {
|
|
80
|
-
// @ts-expect-error Why is this throwing a type error?
|
|
81
|
-
return React.cloneElement(child, {
|
|
82
|
-
key: `child-${index}`,
|
|
83
|
-
index,
|
|
84
|
-
standalone: false,
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
return React.cloneElement(groupComponent, {}, axes, childComponents);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default withContainer(VictoryChart);
|