victory-pie
Advanced tools
Comparing version 9.0.0 to 10.0.0
# VictoryPie Changelog | ||
## 10.0.0 (2017-01-16) | ||
- Uses "_x" and "_y" for internal data format rather than "x" and "y". Though "x" and "y" will | ||
still appear in the data object, they are no longer the source of truth for data values. This may be | ||
a breaking change for custom transitions, functional props, and functional styles. | ||
- Fixes functional style evaluation for enter and exit transitions | ||
## 9.0.0 (2017-01-03) | ||
@@ -4,0 +12,0 @@ |
@@ -22,3 +22,3 @@ Object.defineProperty(exports,"__esModule",{value:true});var _omit2=require("lodash/omit");var _omit3=_interopRequireDefault(_omit2);var _isFunction2=require("lodash/isFunction");var _isFunction3=_interopRequireDefault(_isFunction2);var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2); | ||
var fill=this.getColor(style,colors,index); | ||
var dataStyles=(0,_omit3.default)(datum,["x","y","label"]); | ||
var dataStyles=(0,_omit3.default)(datum,["_x","_y","label"]); | ||
return(0,_defaults3.default)({},{fill:fill},style.data,dataStyles); | ||
@@ -37,3 +37,3 @@ }, | ||
var slice=slices[index]; | ||
var datum=slice.data; | ||
var datum=data[index]; | ||
var eventKey=datum.eventKey||index; | ||
@@ -151,3 +151,3 @@ var dataProps={ | ||
}else{ | ||
text=(0,_isFunction3.default)(props.labels)?props.labels(datum):datum.xName||datum.x; | ||
text=(0,_isFunction3.default)(props.labels)?props.labels(datum):datum.xName||datum._x; | ||
} | ||
@@ -163,4 +163,4 @@ return this.checkForValidText(text); | ||
padAngle(this.degreesToRadians(props.padAngle)). | ||
value(function(datum){return datum.y;}); | ||
value(function(datum){return datum._y;}); | ||
return layoutFunction(data); | ||
}}; |
@@ -13,2 +13,3 @@ Object.defineProperty(exports,"__esModule",{value:true});var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2);var _partialRight2=require("lodash/partialRight");var _partialRight3=_interopRequireDefault(_partialRight2);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;};}();var _react=require("react");var _react2=_interopRequireDefault(_react); | ||
var _helperMethods=require("./helper-methods");var _helperMethods2=_interopRequireDefault(_helperMethods);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}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;}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;} | ||
@@ -214,5 +215,5 @@ | ||
return standalone?this.renderContainer(props,group):group; | ||
}}]);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:_react.PropTypes.object,colorScale:_react.PropTypes.oneOfType([_react.PropTypes.arrayOf(_react.PropTypes.string),_react.PropTypes.oneOf(["grayscale","qualitative","heatmap","warm","cool","red","green","blue"])]),containerComponent:_react.PropTypes.element,cornerRadius:_victoryCore.PropTypes.nonNegative,data:_react.PropTypes.array,dataComponent:_react.PropTypes.element,endAngle:_react.PropTypes.number,events:_react.PropTypes.arrayOf(_react.PropTypes.shape({target:_react.PropTypes.oneOf(["data","labels","parent"]),eventKey:_react.PropTypes.oneOfType([_react.PropTypes.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_react.PropTypes.string]),eventHandlers:_react.PropTypes.object})),eventKey:_react.PropTypes.oneOfType([_react.PropTypes.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_react.PropTypes.string]),groupComponent:_react.PropTypes.element,height:_victoryCore.PropTypes.nonNegative,innerRadius:_victoryCore.PropTypes.nonNegative,labelComponent:_react.PropTypes.element,labelRadius:_react.PropTypes.oneOfType([_victoryCore.PropTypes.nonNegative,_react.PropTypes.func]),labels:_react.PropTypes.oneOfType([_react.PropTypes.func,_react.PropTypes.array]),name:_react.PropTypes.string,padAngle:_victoryCore.PropTypes.nonNegative,padding:_react.PropTypes.oneOfType([_react.PropTypes.number,_react.PropTypes.shape({top:_react.PropTypes.number,bottom:_react.PropTypes.number,left:_react.PropTypes.number,right:_react.PropTypes.number})]),sharedEvents:_react.PropTypes.shape({events:_react.PropTypes.array,getEventState:_react.PropTypes.func}),standalone:_react.PropTypes.bool,startAngle:_react.PropTypes.number,style:_react.PropTypes.shape({parent:_react.PropTypes.object,data:_react.PropTypes.object,labels:_react.PropTypes.object}),theme:_react.PropTypes.object,width:_victoryCore.PropTypes.nonNegative,x:_react.PropTypes.oneOfType([_react.PropTypes.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_react.PropTypes.string,_react.PropTypes.arrayOf(_react.PropTypes.string)]),y:_react.PropTypes.oneOfType([_react.PropTypes.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_react.PropTypes.string,_react.PropTypes.arrayOf(_react.PropTypes.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,x:"x",y:"y",dataComponent:_react2.default.createElement(_victoryCore.Slice,null),labelComponent:_react2.default.createElement(_victoryCore.VictoryLabel,null),containerComponent:_react2.default.createElement(_victoryCore.VictoryContainer,null),groupComponent:_react2.default.createElement("g",null),theme:_victoryCore.VictoryTheme.grayscale};VictoryPie.getBaseProps=(0,_partialRight3.default)(_helperMethods2.default.getBaseProps.bind(_helperMethods2.default),fallbackProps);VictoryPie.expectedComponents=["dataComponent","labelComponent","groupComponent","containerComponent"];exports.default= | ||
}}]);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:_react.PropTypes.object,colorScale:_react.PropTypes.oneOfType([_react.PropTypes.arrayOf(_react.PropTypes.string),_react.PropTypes.oneOf(["grayscale","qualitative","heatmap","warm","cool","red","green","blue"])]),containerComponent:_react.PropTypes.element,cornerRadius:_victoryCore.PropTypes.nonNegative,data:_react.PropTypes.array,dataComponent:_react.PropTypes.element,endAngle:_react.PropTypes.number,events:_react.PropTypes.arrayOf(_react.PropTypes.shape({target:_react.PropTypes.oneOf(["data","labels","parent"]),eventKey:_react.PropTypes.oneOfType([_react.PropTypes.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_react.PropTypes.string]),eventHandlers:_react.PropTypes.object})),eventKey:_react.PropTypes.oneOfType([_react.PropTypes.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_react.PropTypes.string]),groupComponent:_react.PropTypes.element,height:_victoryCore.PropTypes.nonNegative,innerRadius:_victoryCore.PropTypes.nonNegative,labelComponent:_react.PropTypes.element,labelRadius:_react.PropTypes.oneOfType([_victoryCore.PropTypes.nonNegative,_react.PropTypes.func]),labels:_react.PropTypes.oneOfType([_react.PropTypes.func,_react.PropTypes.array]),name:_react.PropTypes.string,padAngle:_victoryCore.PropTypes.nonNegative,padding:_react.PropTypes.oneOfType([_react.PropTypes.number,_react.PropTypes.shape({top:_react.PropTypes.number,bottom:_react.PropTypes.number,left:_react.PropTypes.number,right:_react.PropTypes.number})]),sharedEvents:_react.PropTypes.shape({events:_react.PropTypes.array,getEventState:_react.PropTypes.func}),standalone:_react.PropTypes.bool,startAngle:_react.PropTypes.number,style:_react.PropTypes.shape({parent:_react.PropTypes.object,data:_react.PropTypes.object,labels:_react.PropTypes.object}),theme:_react.PropTypes.object,width:_victoryCore.PropTypes.nonNegative,x:_react.PropTypes.oneOfType([_react.PropTypes.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_react.PropTypes.string,_react.PropTypes.arrayOf(_react.PropTypes.string)]),y:_react.PropTypes.oneOfType([_react.PropTypes.func,_victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer,_victoryCore.PropTypes.nonNegative]),_react.PropTypes.string,_react.PropTypes.arrayOf(_react.PropTypes.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,x:"x",y:"y",dataComponent:_react2.default.createElement(_victoryCore.Slice,null),labelComponent:_react2.default.createElement(_victoryCore.VictoryLabel,null),containerComponent:_react2.default.createElement(_victoryCore.VictoryContainer,null),groupComponent:_react2.default.createElement("g",null),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= | ||
(0,_victoryCore.addEvents)(VictoryPie); |
{ | ||
"name": "victory-pie", | ||
"version": "9.0.0", | ||
"version": "10.0.0", | ||
"description": "D3 pie & donut chart component for React", | ||
@@ -32,3 +32,3 @@ "main": "lib/index.js", | ||
"lodash": "^4.12.0", | ||
"victory-core": "^11.0.0" | ||
"victory-core": "^12.0.2" | ||
}, | ||
@@ -35,0 +35,0 @@ "devDependencies": { |
@@ -22,3 +22,3 @@ import { assign, defaults, isFunction, omit } from "lodash"; | ||
const fill = this.getColor(style, colors, index); | ||
const dataStyles = omit(datum, ["x", "y", "label"]); | ||
const dataStyles = omit(datum, ["_x", "_y", "label"]); | ||
return defaults({}, {fill}, style.data, dataStyles); | ||
@@ -37,3 +37,3 @@ }, | ||
const slice = slices[index]; | ||
const datum = slice.data; | ||
const datum = data[index]; | ||
const eventKey = datum.eventKey || index; | ||
@@ -151,3 +151,3 @@ const dataProps = { | ||
} else { | ||
text = isFunction(props.labels) ? props.labels(datum) : datum.xName || datum.x; | ||
text = isFunction(props.labels) ? props.labels(datum) : datum.xName || datum._x; | ||
} | ||
@@ -163,5 +163,5 @@ return this.checkForValidText(text); | ||
.padAngle(this.degreesToRadians(props.padAngle)) | ||
.value((datum) => { return datum.y; }); | ||
.value((datum) => { return datum._y; }); | ||
return layoutFunction(data); | ||
} | ||
}; |
@@ -6,2 +6,3 @@ import React, { PropTypes } from "react"; | ||
Helpers, | ||
Data, | ||
PropTypes as CustomPropTypes, | ||
@@ -44,8 +45,8 @@ Slice, | ||
duration: 500, | ||
before: () => ({ y: 0, label: " " }) | ||
before: () => ({ _y: 0, label: " " }) | ||
}, | ||
onEnter: { | ||
duration: 500, | ||
before: () => ({ y: 0, label: " " }), | ||
after: (datum) => ({ y: datum.y, label: datum.label }) | ||
before: () => ({ _y: 0, label: " " }), | ||
after: (datum) => ({ y_: datum._y, label: datum.label }) | ||
} | ||
@@ -141,3 +142,3 @@ }; | ||
static getBaseProps = partialRight(PieHelpers.getBaseProps.bind(PieHelpers), fallbackProps); | ||
static getData = Data.getData.bind(Data); | ||
static expectedComponents = [ | ||
@@ -191,3 +192,3 @@ "dataComponent", "labelComponent", "groupComponent", "containerComponent" | ||
// If animating, return a `VictoryAnimation` element that will create | ||
// a new `VictoryBar` with nearly identical props, except (1) tweened | ||
// a new `VictoryPie` with nearly identical props, except (1) tweened | ||
// and (2) `animate` set to null so we don't recurse forever. | ||
@@ -194,0 +195,0 @@ if (this.shouldAnimate()) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
867607
16351
+ Addedvictory-core@12.0.2(transitive)
- Removedvictory-core@11.0.1(transitive)
Updatedvictory-core@^12.0.2