victory-histogram 36.9.2 → 37.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/victory-histogram.js +4324 -5534
- package/dist/victory-histogram.min.js +1 -1
- package/es/helper-methods.js +154 -190
- package/es/victory-histogram.js +65 -114
- package/lib/helper-methods.js +156 -214
- package/lib/index.js +0 -2
- package/lib/victory-histogram.js +65 -122
- package/package.json +4 -4
package/lib/victory-histogram.js
CHANGED
|
@@ -4,155 +4,98 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VictoryHistogram = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _victoryBar = require("victory-bar");
|
|
11
|
-
|
|
12
9
|
var _victoryCore = require("victory-core");
|
|
13
|
-
|
|
14
10
|
var _helperMethods = require("./helper-methods");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
-
|
|
20
|
-
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); } }
|
|
21
|
-
|
|
22
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
|
-
|
|
24
|
-
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); }
|
|
25
|
-
|
|
26
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
|
-
|
|
28
|
-
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); }; }
|
|
29
|
-
|
|
30
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
31
|
-
|
|
32
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
-
|
|
34
|
-
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; } }
|
|
35
|
-
|
|
36
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
37
|
-
|
|
38
|
-
var fallbackProps = {
|
|
12
|
+
const fallbackProps = {
|
|
39
13
|
width: 450,
|
|
40
14
|
height: 300,
|
|
41
15
|
padding: 50
|
|
42
16
|
};
|
|
43
|
-
|
|
17
|
+
const defaultData = [];
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
44
20
|
|
|
45
21
|
/**
|
|
46
22
|
* Draw SVG histogram charts with React. VictoryHistogram is a composable component, so it doesn't include axes
|
|
47
23
|
* Check out VictoryChart for complete histogram charts and more.
|
|
48
24
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return _super.apply(this, arguments);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
_createClass(VictoryHistogramBase, [{
|
|
61
|
-
key: "shouldAnimate",
|
|
62
|
-
value: // Overridden in native versions
|
|
63
|
-
function shouldAnimate() {
|
|
64
|
-
return !!this.props.animate;
|
|
65
|
-
}
|
|
66
|
-
}, {
|
|
67
|
-
key: "render",
|
|
68
|
-
value: function render() {
|
|
69
|
-
var animationWhitelist = VictoryHistogramBase.animationWhitelist,
|
|
70
|
-
role = VictoryHistogramBase.role;
|
|
71
|
-
|
|
72
|
-
var props = _victoryCore.Helpers.modifyProps(this.props, fallbackProps, role);
|
|
73
|
-
|
|
74
|
-
if (this.shouldAnimate()) {
|
|
75
|
-
return this.animateComponent(props, animationWhitelist);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
var children = this.renderData(props);
|
|
79
|
-
var component = props.standalone ? this.renderContainer(props.containerComponent, children) : children;
|
|
80
|
-
return _victoryCore.UserProps.withSafeUserProps(component, props);
|
|
81
|
-
}
|
|
82
|
-
}]);
|
|
83
|
-
|
|
84
|
-
return VictoryHistogramBase;
|
|
85
|
-
}(_react.default.Component);
|
|
86
|
-
|
|
87
|
-
VictoryHistogramBase.animationWhitelist = ["data", "domain", "height", "padding", "style", "width"];
|
|
88
|
-
VictoryHistogramBase.displayName = "VictoryHistogram";
|
|
89
|
-
VictoryHistogramBase.role = "histogram";
|
|
90
|
-
VictoryHistogramBase.defaultTransitions = {
|
|
91
|
-
onLoad: {
|
|
92
|
-
duration: 2000,
|
|
93
|
-
before: function () {
|
|
94
|
-
return {
|
|
25
|
+
class VictoryHistogramBase extends _react.default.Component {
|
|
26
|
+
static animationWhitelist = ["data", "domain", "height", "padding", "style", "width"];
|
|
27
|
+
static displayName = "VictoryHistogram";
|
|
28
|
+
static role = "histogram";
|
|
29
|
+
static defaultTransitions = {
|
|
30
|
+
onLoad: {
|
|
31
|
+
duration: 2000,
|
|
32
|
+
before: () => ({
|
|
95
33
|
_y: 0,
|
|
96
34
|
_y1: 0,
|
|
97
35
|
_y0: 0
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
after: function (datum) {
|
|
101
|
-
return {
|
|
36
|
+
}),
|
|
37
|
+
after: datum => ({
|
|
102
38
|
_y: datum._y,
|
|
103
39
|
_y1: datum._y1,
|
|
104
40
|
_y0: datum._y0
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
before: function () {
|
|
111
|
-
return {
|
|
41
|
+
})
|
|
42
|
+
},
|
|
43
|
+
onExit: {
|
|
44
|
+
duration: 500,
|
|
45
|
+
before: () => ({
|
|
112
46
|
_y: 0,
|
|
113
47
|
yOffset: 0
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
before: function () {
|
|
120
|
-
return {
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
onEnter: {
|
|
51
|
+
duration: 500,
|
|
52
|
+
before: () => ({
|
|
121
53
|
_y: 0,
|
|
122
54
|
_y1: 0,
|
|
123
55
|
_y0: 0
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
after: function (datum) {
|
|
127
|
-
return {
|
|
56
|
+
}),
|
|
57
|
+
after: datum => ({
|
|
128
58
|
_y: datum._y,
|
|
129
59
|
_y1: datum._y1,
|
|
130
60
|
_y0: datum._y0
|
|
131
|
-
}
|
|
61
|
+
})
|
|
132
62
|
}
|
|
63
|
+
};
|
|
64
|
+
static getFormattedData = _helperMethods.getFormattedData;
|
|
65
|
+
static defaultProps = {
|
|
66
|
+
containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
|
|
67
|
+
data: defaultData,
|
|
68
|
+
dataComponent: /*#__PURE__*/_react.default.createElement(_victoryBar.Bar, null),
|
|
69
|
+
groupComponent: /*#__PURE__*/_react.default.createElement("g", {
|
|
70
|
+
role: "presentation"
|
|
71
|
+
}),
|
|
72
|
+
labelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
|
|
73
|
+
samples: 50,
|
|
74
|
+
sortOrder: "ascending",
|
|
75
|
+
standalone: true,
|
|
76
|
+
theme: _victoryCore.VictoryTheme.grayscale
|
|
77
|
+
};
|
|
78
|
+
static getDomain = _helperMethods.getDomain;
|
|
79
|
+
static getData = _helperMethods.getData;
|
|
80
|
+
static getBaseProps = props => (0, _helperMethods.getBaseProps)(props, fallbackProps);
|
|
81
|
+
static expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"];
|
|
82
|
+
|
|
83
|
+
// Overridden in native versions
|
|
84
|
+
shouldAnimate() {
|
|
85
|
+
return !!this.props.animate;
|
|
133
86
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
VictoryHistogramBase.getDomain = _helperMethods.getDomain;
|
|
150
|
-
VictoryHistogramBase.getData = _helperMethods.getData;
|
|
151
|
-
|
|
152
|
-
VictoryHistogramBase.getBaseProps = function (props) {
|
|
153
|
-
return (0, _helperMethods.getBaseProps)(props, fallbackProps);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
VictoryHistogramBase.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"];
|
|
157
|
-
var VictoryHistogram = (0, _victoryCore.addEvents)(VictoryHistogramBase);
|
|
158
|
-
exports.VictoryHistogram = VictoryHistogram;
|
|
87
|
+
render() {
|
|
88
|
+
const {
|
|
89
|
+
animationWhitelist,
|
|
90
|
+
role
|
|
91
|
+
} = VictoryHistogramBase;
|
|
92
|
+
const props = _victoryCore.Helpers.modifyProps(this.props, fallbackProps, role);
|
|
93
|
+
if (this.shouldAnimate()) {
|
|
94
|
+
return this.animateComponent(props, animationWhitelist);
|
|
95
|
+
}
|
|
96
|
+
const children = this.renderData(props);
|
|
97
|
+
const component = props.standalone ? this.renderContainer(props.containerComponent, children) : children;
|
|
98
|
+
return _victoryCore.UserProps.withSafeUserProps(component, props);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const VictoryHistogram = exports.VictoryHistogram = (0, _victoryCore.addEvents)(VictoryHistogramBase);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-histogram",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "37.0.0",
|
|
4
4
|
"description": "Histogram Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.19",
|
|
24
24
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-bar": "^
|
|
26
|
-
"victory-core": "^
|
|
27
|
-
"victory-vendor": "^
|
|
25
|
+
"victory-bar": "^37.0.0",
|
|
26
|
+
"victory-core": "^37.0.0",
|
|
27
|
+
"victory-vendor": "^37.0.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=16.6.0"
|