victory-pie 11.2.0 → 11.4.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 +17 -0
- package/dist/victory-pie.js +25069 -20280
- package/dist/victory-pie.min.js +1 -9
- package/es/components/helper-methods.js +165 -0
- package/es/components/victory-pie.js +140 -0
- package/es/index.js +2 -0
- package/lib/components/helper-methods.js +187 -171
- package/lib/components/victory-pie.js +150 -161
- package/lib/index.js +12 -2
- package/package.json +6 -4
- package/src/components/helper-methods.js +6 -7
- package/src/components/victory-pie.js +1 -1
|
@@ -1,165 +1,154 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _partialRight2 = require("lodash/partialRight");
|
|
6
6
|
|
|
7
|
+
var _partialRight3 = _interopRequireDefault(_partialRight2);
|
|
7
8
|
|
|
9
|
+
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
10
|
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
{var
|
|
154
|
-
role=this.constructor.role;
|
|
155
|
-
var props=_victoryCore.Helpers.modifyProps(this.props,fallbackProps,role);
|
|
156
|
-
if(this.shouldAnimate()){
|
|
157
|
-
return this.animateComponent(props,animationWhitelist);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
var children=this.renderData(props);
|
|
161
|
-
return props.standalone?this.renderContainer(props.containerComponent,children):children;
|
|
162
|
-
}}]);return VictoryPie;}(_react2.default.Component);VictoryPie.displayName="VictoryPie";VictoryPie.defaultTransitions={onExit:{duration:500,before:function before(){return{_y:0,label:" "};}},onEnter:{duration:500,before:function before(){return{_y:0,label:" "};},after:function after(datum){return{y_:datum._y,label:datum.label};}}};VictoryPie.propTypes={animate:_propTypes2.default.object,colorScale:_propTypes2.default.oneOfType([_propTypes2.default.arrayOf(_propTypes2.default.string),_propTypes2.default.oneOf(["grayscale","qualitative","heatmap","warm","cool","red","green","blue"])]),containerComponent:_propTypes2.default.element,cornerRadius:_victoryCore.PropTypes.nonNegative,data:_propTypes2.default.array,dataComponent:_propTypes2.default.element,endAngle:_propTypes2.default.number,eventKey:_propTypes2.default.oneOfType([_propTypes2.default.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_propTypes2.default.string]),events:_propTypes2.default.arrayOf(_propTypes2.default.shape({target:_propTypes2.default.oneOf(["data","labels","parent"]),eventKey:_propTypes2.default.oneOfType([_propTypes2.default.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_propTypes2.default.string]),eventHandlers:_propTypes2.default.object})),groupComponent:_propTypes2.default.element,height:_victoryCore.PropTypes.nonNegative,innerRadius:_victoryCore.PropTypes.nonNegative,labelComponent:_propTypes2.default.element,labelRadius:_propTypes2.default.oneOfType([_victoryCore.PropTypes.nonNegative,_propTypes2.default.func]),labels:_propTypes2.default.oneOfType([_propTypes2.default.func,_propTypes2.default.array]),name:_propTypes2.default.string,padAngle:_victoryCore.PropTypes.nonNegative,padding:_propTypes2.default.oneOfType([_propTypes2.default.number,_propTypes2.default.shape({top:_propTypes2.default.number,bottom:_propTypes2.default.number,left:_propTypes2.default.number,right:_propTypes2.default.number})]),sharedEvents:_propTypes2.default.shape({events:_propTypes2.default.array,getEventState:_propTypes2.default.func}),sortKey:_propTypes2.default.oneOfType([_propTypes2.default.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_propTypes2.default.string,_propTypes2.default.arrayOf(_propTypes2.default.string)]),standalone:_propTypes2.default.bool,startAngle:_propTypes2.default.number,style:_propTypes2.default.shape({parent:_propTypes2.default.object,data:_propTypes2.default.object,labels:_propTypes2.default.object}),theme:_propTypes2.default.object,width:_victoryCore.PropTypes.nonNegative,x:_propTypes2.default.oneOfType([_propTypes2.default.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_propTypes2.default.string,_propTypes2.default.arrayOf(_propTypes2.default.string)]),y:_propTypes2.default.oneOfType([_propTypes2.default.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_propTypes2.default.string,_propTypes2.default.arrayOf(_propTypes2.default.string)])};VictoryPie.defaultProps={data:[{x:"A",y:1},{x:"B",y:2},{x:"C",y:3},{x:"D",y:1},{x:"E",y:2}],standalone:true,dataComponent:_react2.default.createElement(_victoryCore.Slice,{__source:{fileName:_jsxFileName,lineNumber:135}}),labelComponent:_react2.default.createElement(_victoryCore.VictoryLabel,{__source:{fileName:_jsxFileName,lineNumber:136}}),containerComponent:_react2.default.createElement(_victoryCore.VictoryContainer,{__source:{fileName:_jsxFileName,lineNumber:137}}),groupComponent:_react2.default.createElement("g",{__source:{fileName:_jsxFileName,lineNumber:138}}),theme:_victoryCore.VictoryTheme.grayscale};VictoryPie.getBaseProps=(0,_partialRight3.default)(_helperMethods2.default.getBaseProps.bind(_helperMethods2.default),fallbackProps);VictoryPie.getData=_victoryCore.Data.getData.bind(_victoryCore.Data);VictoryPie.expectedComponents=["dataComponent","labelComponent","groupComponent","containerComponent"];exports.default=
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
(0,_victoryCore.addEvents)(VictoryPie);
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
|
|
13
|
+
var _react2 = _interopRequireDefault(_react);
|
|
14
|
+
|
|
15
|
+
var _propTypes = require("prop-types");
|
|
16
|
+
|
|
17
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
18
|
+
|
|
19
|
+
var _victoryCore = require("victory-core");
|
|
20
|
+
|
|
21
|
+
var _helperMethods = require("./helper-methods");
|
|
22
|
+
|
|
23
|
+
var _helperMethods2 = _interopRequireDefault(_helperMethods);
|
|
24
|
+
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
+
|
|
27
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
28
|
+
|
|
29
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
30
|
+
|
|
31
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1, 2] }]*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var fallbackProps = {
|
|
35
|
+
endAngle: 360,
|
|
36
|
+
height: 400,
|
|
37
|
+
innerRadius: 0,
|
|
38
|
+
cornerRadius: 0,
|
|
39
|
+
padAngle: 0,
|
|
40
|
+
padding: 30,
|
|
41
|
+
width: 400,
|
|
42
|
+
startAngle: 0,
|
|
43
|
+
colorScale: ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525", "#000000"]
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var animationWhitelist = ["data", "endAngle", "height", "innerRadius", "cornerRadius", "padAngle", "padding", "colorScale", "startAngle", "style", "width"];
|
|
47
|
+
|
|
48
|
+
var VictoryPie = function (_React$Component) {
|
|
49
|
+
_inherits(VictoryPie, _React$Component);
|
|
50
|
+
|
|
51
|
+
function VictoryPie() {
|
|
52
|
+
_classCallCheck(this, VictoryPie);
|
|
53
|
+
|
|
54
|
+
return _possibleConstructorReturn(this, (VictoryPie.__proto__ || Object.getPrototypeOf(VictoryPie)).apply(this, arguments));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
_createClass(VictoryPie, [{
|
|
58
|
+
key: "shouldAnimate",
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// Overridden in victory-native
|
|
62
|
+
value: function shouldAnimate() {
|
|
63
|
+
return Boolean(this.props.animate);
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "render",
|
|
67
|
+
value: function render() {
|
|
68
|
+
var role = this.constructor.role;
|
|
69
|
+
|
|
70
|
+
var props = _victoryCore.Helpers.modifyProps(this.props, fallbackProps, role);
|
|
71
|
+
if (this.shouldAnimate()) {
|
|
72
|
+
return this.animateComponent(props, animationWhitelist);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var children = this.renderData(props);
|
|
76
|
+
return props.standalone ? this.renderContainer(props.containerComponent, children) : children;
|
|
77
|
+
}
|
|
78
|
+
}]);
|
|
79
|
+
|
|
80
|
+
return VictoryPie;
|
|
81
|
+
}(_react2.default.Component);
|
|
82
|
+
|
|
83
|
+
VictoryPie.displayName = "VictoryPie";
|
|
84
|
+
VictoryPie.defaultTransitions = {
|
|
85
|
+
onExit: {
|
|
86
|
+
duration: 500,
|
|
87
|
+
before: function () {
|
|
88
|
+
return { _y: 0, label: " " };
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
onEnter: {
|
|
92
|
+
duration: 500,
|
|
93
|
+
before: function () {
|
|
94
|
+
return { _y: 0, label: " " };
|
|
95
|
+
},
|
|
96
|
+
after: function (datum) {
|
|
97
|
+
return { y_: datum._y, label: datum.label };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
VictoryPie.propTypes = {
|
|
102
|
+
animate: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.object]),
|
|
103
|
+
colorScale: _propTypes2.default.oneOfType([_propTypes2.default.arrayOf(_propTypes2.default.string), _propTypes2.default.oneOf(["grayscale", "qualitative", "heatmap", "warm", "cool", "red", "green", "blue"])]),
|
|
104
|
+
containerComponent: _propTypes2.default.element,
|
|
105
|
+
cornerRadius: _victoryCore.PropTypes.nonNegative,
|
|
106
|
+
data: _propTypes2.default.array,
|
|
107
|
+
dataComponent: _propTypes2.default.element,
|
|
108
|
+
endAngle: _propTypes2.default.number,
|
|
109
|
+
eventKey: _propTypes2.default.oneOfType([_propTypes2.default.func, _victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer, _victoryCore.PropTypes.nonNegative]), _propTypes2.default.string]),
|
|
110
|
+
events: _propTypes2.default.arrayOf(_propTypes2.default.shape({
|
|
111
|
+
target: _propTypes2.default.oneOf(["data", "labels", "parent"]),
|
|
112
|
+
eventKey: _propTypes2.default.oneOfType([_propTypes2.default.func, _victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer, _victoryCore.PropTypes.nonNegative]), _propTypes2.default.string]),
|
|
113
|
+
eventHandlers: _propTypes2.default.object
|
|
114
|
+
})),
|
|
115
|
+
groupComponent: _propTypes2.default.element,
|
|
116
|
+
height: _victoryCore.PropTypes.nonNegative,
|
|
117
|
+
innerRadius: _victoryCore.PropTypes.nonNegative,
|
|
118
|
+
labelComponent: _propTypes2.default.element,
|
|
119
|
+
labelRadius: _propTypes2.default.oneOfType([_victoryCore.PropTypes.nonNegative, _propTypes2.default.func]),
|
|
120
|
+
labels: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.array]),
|
|
121
|
+
name: _propTypes2.default.string,
|
|
122
|
+
padAngle: _victoryCore.PropTypes.nonNegative,
|
|
123
|
+
padding: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({
|
|
124
|
+
top: _propTypes2.default.number, bottom: _propTypes2.default.number,
|
|
125
|
+
left: _propTypes2.default.number, right: _propTypes2.default.number
|
|
126
|
+
})]),
|
|
127
|
+
sharedEvents: _propTypes2.default.shape({
|
|
128
|
+
events: _propTypes2.default.array,
|
|
129
|
+
getEventState: _propTypes2.default.func
|
|
130
|
+
}),
|
|
131
|
+
sortKey: _propTypes2.default.oneOfType([_propTypes2.default.func, _victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer, _victoryCore.PropTypes.nonNegative]), _propTypes2.default.string, _propTypes2.default.arrayOf(_propTypes2.default.string)]),
|
|
132
|
+
standalone: _propTypes2.default.bool,
|
|
133
|
+
startAngle: _propTypes2.default.number,
|
|
134
|
+
style: _propTypes2.default.shape({
|
|
135
|
+
parent: _propTypes2.default.object, data: _propTypes2.default.object, labels: _propTypes2.default.object
|
|
136
|
+
}),
|
|
137
|
+
theme: _propTypes2.default.object,
|
|
138
|
+
width: _victoryCore.PropTypes.nonNegative,
|
|
139
|
+
x: _propTypes2.default.oneOfType([_propTypes2.default.func, _victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer, _victoryCore.PropTypes.nonNegative]), _propTypes2.default.string, _propTypes2.default.arrayOf(_propTypes2.default.string)]),
|
|
140
|
+
y: _propTypes2.default.oneOfType([_propTypes2.default.func, _victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer, _victoryCore.PropTypes.nonNegative]), _propTypes2.default.string, _propTypes2.default.arrayOf(_propTypes2.default.string)])
|
|
141
|
+
};
|
|
142
|
+
VictoryPie.defaultProps = {
|
|
143
|
+
data: [{ x: "A", y: 1 }, { x: "B", y: 2 }, { x: "C", y: 3 }, { x: "D", y: 1 }, { x: "E", y: 2 }],
|
|
144
|
+
standalone: true,
|
|
145
|
+
dataComponent: _react2.default.createElement(_victoryCore.Slice, null),
|
|
146
|
+
labelComponent: _react2.default.createElement(_victoryCore.VictoryLabel, null),
|
|
147
|
+
containerComponent: _react2.default.createElement(_victoryCore.VictoryContainer, null),
|
|
148
|
+
groupComponent: _react2.default.createElement("g", null),
|
|
149
|
+
theme: _victoryCore.VictoryTheme.grayscale
|
|
150
|
+
};
|
|
151
|
+
VictoryPie.getBaseProps = (0, _partialRight3.default)(_helperMethods2.default.getBaseProps.bind(_helperMethods2.default), fallbackProps);
|
|
152
|
+
VictoryPie.getData = _victoryCore.Data.getData.bind(_victoryCore.Data);
|
|
153
|
+
VictoryPie.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"];
|
|
154
|
+
exports.default = (0, _victoryCore.addEvents)(VictoryPie);
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.VictoryPie = undefined;
|
|
5
|
+
|
|
6
|
+
var _victoryPie = require("./components/victory-pie");
|
|
7
|
+
|
|
8
|
+
var _victoryPie2 = _interopRequireDefault(_victoryPie);
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
exports.VictoryPie = _victoryPie2.default;
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-pie",
|
|
3
|
-
"version": "11.2
|
|
3
|
+
"version": "11.4.2",
|
|
4
4
|
"description": "D3 pie & donut chart component for React",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"module": "es/index.js",
|
|
7
|
+
"jsnext:main": "es/index.js",
|
|
6
8
|
"repository": {
|
|
7
9
|
"type": "git",
|
|
8
10
|
"url": "https://github.com/FormidableLabs/victory-pie.git"
|
|
@@ -28,11 +30,11 @@
|
|
|
28
30
|
"dependencies": {
|
|
29
31
|
"d3-shape": "^1.0.0",
|
|
30
32
|
"lodash": "^4.17.4",
|
|
31
|
-
"victory-core": "^
|
|
33
|
+
"victory-core": "^17.0.0"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
36
|
"@kadira/storybook": "^1.25.0",
|
|
35
|
-
"builder-victory-component-dev": "^
|
|
37
|
+
"builder-victory-component-dev": "^5.0.1",
|
|
36
38
|
"chai": "^3.5.0",
|
|
37
39
|
"chai-enzyme": "0.4.1",
|
|
38
40
|
"enzyme": "^2.4.1",
|
|
@@ -44,7 +46,7 @@
|
|
|
44
46
|
"sinon": "^1.17.5",
|
|
45
47
|
"sinon-chai": "^2.8.0",
|
|
46
48
|
"builder": "^3.2.1",
|
|
47
|
-
"builder-victory-component": "^
|
|
49
|
+
"builder-victory-component": "^5.0.1"
|
|
48
50
|
},
|
|
49
51
|
"publishr": {
|
|
50
52
|
"dependencies": [
|
|
@@ -55,7 +55,9 @@ export default {
|
|
|
55
55
|
getLabelProps(props, dataProps, calculatedValues) {
|
|
56
56
|
const { index, datum, data, slice } = dataProps;
|
|
57
57
|
const { style, radius, origin } = calculatedValues;
|
|
58
|
-
const labelStyle =
|
|
58
|
+
const labelStyle = Helpers.evaluateStyle(
|
|
59
|
+
assign({ padding: 0 }, style.labels), datum, props.active
|
|
60
|
+
);
|
|
59
61
|
const labelRadius = Helpers.evaluateProp(props.labelRadius, datum);
|
|
60
62
|
const labelPosition = this.getLabelPosition(radius, labelRadius, labelStyle);
|
|
61
63
|
const position = labelPosition.centroid(slice);
|
|
@@ -79,12 +81,9 @@ export default {
|
|
|
79
81
|
const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale);
|
|
80
82
|
const padding = Helpers.getPadding(props);
|
|
81
83
|
const radius = this.getRadius(props, padding);
|
|
82
|
-
const offsetWidth =
|
|
83
|
-
const offsetHeight =
|
|
84
|
-
const origin = {
|
|
85
|
-
x: offsetWidth + radius > width ? radius + padding.left - padding.right : offsetWidth,
|
|
86
|
-
y: offsetHeight + radius > height ? radius + padding.top - padding.bottom : offsetHeight
|
|
87
|
-
};
|
|
84
|
+
const offsetWidth = ((radius + padding.left) + (width - radius - padding.right)) / 2;
|
|
85
|
+
const offsetHeight = ((radius + padding.top) + (height - radius - padding.bottom)) / 2;
|
|
86
|
+
const origin = { x: offsetWidth, y: offsetHeight };
|
|
88
87
|
const data = Data.getData(props);
|
|
89
88
|
const slices = this.getSlices(props, data);
|
|
90
89
|
const pathFunction = d3Shape.arc()
|
|
@@ -51,7 +51,7 @@ class VictoryPie extends React.Component {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
static propTypes = {
|
|
54
|
-
animate: PropTypes.object,
|
|
54
|
+
animate: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
55
55
|
colorScale: PropTypes.oneOfType([
|
|
56
56
|
PropTypes.arrayOf(PropTypes.string),
|
|
57
57
|
PropTypes.oneOf([
|