victory-chart
Advanced tools
Comparing version 14.0.4 to 15.0.0
# VictoryChart Changelog | ||
## 15.0.0 (2017-01-03) | ||
- Adds `VictorySelectionContainer` | ||
- All functional styles and props are evaluated at the level of the primitive component rather than eariler | ||
- Adds support for `defaultEvents` on `containerComponents` | ||
## 14.0.4 (2016-12-13) | ||
@@ -4,0 +10,0 @@ |
@@ -16,4 +16,4 @@ Object.defineProperty(exports,"__esModule",{value:true});var _last2=require("lodash/last");var _last3=_interopRequireDefault(_last2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2); | ||
scale:scale, | ||
interpolation:_victoryCore.Helpers.evaluateProp(interpolation,data), | ||
style:_victoryCore.Helpers.evaluateStyle(style.data,data)}; | ||
interpolation:interpolation, | ||
style:style.data}; | ||
@@ -28,5 +28,4 @@ | ||
var text=_victoryCore.Helpers.evaluateProp(label,data); | ||
if(text!==undefined&&text!==null||props.events||props.sharedEvents){ | ||
baseProps.all.labels=this.getLabelProps(dataProps,text,style); | ||
if(label!==undefined&&label!==null||props.events||props.sharedEvents){ | ||
baseProps.all.labels=this.getLabelProps(dataProps,label,style); | ||
} | ||
@@ -48,3 +47,3 @@ | ||
y0:lastData?scale.y(lastData.y0):0, | ||
style:labelStyle, | ||
style:calculatedStyle.labels, | ||
textAnchor:labelStyle.textAnchor||"start", | ||
@@ -51,0 +50,0 @@ verticalAnchor:labelStyle.verticalAnchor||"middle", |
@@ -12,3 +12,17 @@ Object.defineProperty(exports,"__esModule",{value:true});var _without2=require("lodash/without");var _without3=_interopRequireDefault(_without2);var _range2=require("lodash/range");var _range3=_interopRequireDefault(_range2);var _isFunction2=require("lodash/isFunction");var _isFunction3=_interopRequireDefault(_isFunction2);var _defaultsDeep2=require("lodash/defaultsDeep");var _defaultsDeep3=_interopRequireDefault(_defaultsDeep2);var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _includes2=require("lodash/includes");var _includes3=_interopRequireDefault(_includes2); | ||
{ | ||
evaluateProp:function evaluateProp(prop,data,index){ | ||
return(0,_isFunction3.default)(prop)?prop(data,index):prop; | ||
}, | ||
evaluateStyle:function evaluateStyle(style,data,index){var _this=this; | ||
if(!style||!Object.keys(style).some(function(value){return(0,_isFunction3.default)(style[value]);})){ | ||
return style; | ||
} | ||
return Object.keys(style).reduce(function(prev,curr){ | ||
prev[curr]=_this.evaluateProp(style[curr],data,index); | ||
return prev; | ||
},{}); | ||
}, | ||
getDomain:function getDomain(props,axis){ | ||
@@ -142,5 +156,5 @@ var inherentAxis=this.getAxis(props); | ||
return{ | ||
tickStyle:_victoryCore.Helpers.evaluateStyle(style.ticks,tick,index), | ||
labelStyle:_victoryCore.Helpers.evaluateStyle(style.tickLabels,tick,index), | ||
gridStyle:_victoryCore.Helpers.evaluateStyle(style.grid,tick,index)}; | ||
tickStyle:this.evaluateStyle(style.ticks,tick,index), | ||
labelStyle:this.evaluateStyle(style.tickLabels,tick,index), | ||
gridStyle:this.evaluateStyle(style.grid,tick,index)}; | ||
@@ -317,3 +331,3 @@ }, | ||
getOffset:function getOffset(props,calculatedValues){var | ||
getOffset:function getOffset(props,calculatedValues){var _this2=this;var | ||
@@ -331,3 +345,3 @@ style= | ||
var tick=stringTicks?props.tickValues[data-1]:data; | ||
var tickStyle=_victoryCore.Helpers.evaluateStyle(style.ticks,tick); | ||
var tickStyle=_this2.evaluateStyle(style.ticks,tick); | ||
return tickStyle.size||0; | ||
@@ -334,0 +348,0 @@ }); |
@@ -51,7 +51,7 @@ Object.defineProperty(exports,"__esModule",{value:true});var _omit2=require("lodash/omit");var _omit3=_interopRequireDefault(_omit2);var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2); | ||
return _victoryCore.Helpers.evaluateStyle((0,_defaults3.default)({},styleData,baseStyle),datum); | ||
return(0,_defaults3.default)({},styleData,baseStyle); | ||
}, | ||
getLabelStyle:function getLabelStyle(style,datum){ | ||
var labelStyle=(0,_defaults3.default)({},{ | ||
return(0,_defaults3.default)({},{ | ||
angle:datum.angle, | ||
@@ -61,3 +61,2 @@ textAnchor:datum.textAnchor, | ||
style); | ||
return _victoryCore.Helpers.evaluateStyle(labelStyle,datum); | ||
}, | ||
@@ -67,3 +66,3 @@ | ||
return datum.label||(Array.isArray(props.labels)? | ||
props.labels[index]:_victoryCore.Helpers.evaluateProp(props.labels,datum)); | ||
props.labels[index]:props.labels); | ||
}, | ||
@@ -70,0 +69,0 @@ |
@@ -152,4 +152,3 @@ Object.defineProperty(exports,"__esModule",{value:true});var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _omit2=require("lodash/omit");var _omit3=_interopRequireDefault(_omit2);var _pick2=require("lodash/pick");var _pick3=_interopRequireDefault(_pick2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2); | ||
var stroke=this.isTransparent(strokeColor)?fill:strokeColor||"black"; | ||
var baseDataStyle=(0,_defaults3.default)({},stylesFromData,{stroke:stroke,fill:fill},style); | ||
return _victoryCore.Helpers.evaluateStyle(baseDataStyle,datum); | ||
return(0,_defaults3.default)({},stylesFromData,{stroke:stroke,fill:fill},style); | ||
}, | ||
@@ -159,3 +158,3 @@ | ||
return datum.label||(Array.isArray(props.labels)? | ||
props.labels[index]:_victoryCore.Helpers.evaluateProp(props.labels,datum)); | ||
props.labels[index]:props.labels); | ||
}, | ||
@@ -165,7 +164,6 @@ | ||
labelStyle=labelStyle||{};var | ||
datum=dataProps.datum,size=dataProps.size,style=dataProps.style; | ||
size=dataProps.size,style=dataProps.style; | ||
var matchedStyle=(0,_pick3.default)(style,["opacity","fill"]); | ||
var padding=labelStyle.padding||size*0.25; | ||
var baseLabelStyle=(0,_defaults3.default)({},labelStyle,matchedStyle,{padding:padding}); | ||
return _victoryCore.Helpers.evaluateStyle(baseLabelStyle,datum); | ||
return(0,_defaults3.default)({},labelStyle,matchedStyle,{padding:padding}); | ||
}}; |
@@ -93,4 +93,13 @@ Object.defineProperty(exports,"__esModule",{value:true});var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);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;};}(); | ||
function VictoryChart(props){_classCallCheck(this,VictoryChart);var _this=_possibleConstructorReturn(this,(VictoryChart.__proto__||Object.getPrototypeOf(VictoryChart)).call(this, | ||
props)); | ||
_this.state={}; | ||
if(props.animate){ | ||
@@ -103,6 +112,8 @@ _this.state={ | ||
_this.setAnimationState=_wrapper2.default.setAnimationState.bind(_this); | ||
}return _this; | ||
} | ||
_this.events=_wrapper2.default.getAllEvents(props);return _this; | ||
}_createClass(VictoryChart,[{key:"componentWillMount",value:function componentWillMount() | ||
{var _this2=this; | ||
this.events=_wrapper2.default.getAllEvents(this.props); | ||
this.getContainerRef=function(component){return _this2.containerRef=component;}; | ||
@@ -115,2 +126,3 @@ }},{key:"componentWillReceiveProps",value:function componentWillReceiveProps( | ||
} | ||
this.events=_wrapper2.default.getAllEvents(nextProps); | ||
}},{key:"getStyles",value:function getStyles( | ||
@@ -278,3 +290,3 @@ | ||
var modifiedProps=_victoryCore.Helpers.modifyProps(props,fallbackProps,"chart");var | ||
standalone=modifiedProps.standalone,events=modifiedProps.events,eventKey=modifiedProps.eventKey; | ||
standalone=modifiedProps.standalone,eventKey=modifiedProps.eventKey; | ||
var childComponents=_helperMethods2.default.getChildComponents(modifiedProps, | ||
@@ -289,5 +301,5 @@ modifiedProps.defaultAxes); | ||
var container=standalone?this.getContainer(modifiedProps,calculatedProps):group; | ||
if(events){ | ||
if(this.events){ | ||
return( | ||
_react2.default.createElement(_victoryCore.VictorySharedEvents,{events:events,eventKey:eventKey,container:container}, | ||
_react2.default.createElement(_victoryCore.VictorySharedEvents,{events:this.events,eventKey:eventKey,container:container}, | ||
newChildren)); | ||
@@ -298,2 +310,2 @@ | ||
return standalone?_react2.default.cloneElement(container,container.props,group):group; | ||
}}]);return VictoryChart;}(_react2.default.Component);VictoryChart.displayName="VictoryChart";VictoryChart.propTypes={animate:_react.PropTypes.object,children:_react2.default.PropTypes.oneOfType([_react2.default.PropTypes.arrayOf(_react2.default.PropTypes.node),_react2.default.PropTypes.node]),containerComponent:_react.PropTypes.element,defaultAxes:_react.PropTypes.shape({independent:_react.PropTypes.element,dependent:_react.PropTypes.element}),domain:_react.PropTypes.oneOfType([_victoryCore.PropTypes.domain,_react.PropTypes.shape({x:_victoryCore.PropTypes.domain,y:_victoryCore.PropTypes.domain})]),domainPadding:_react.PropTypes.oneOfType([_react.PropTypes.shape({x:_react.PropTypes.oneOfType([_react.PropTypes.number,_victoryCore.PropTypes.domain]),y:_react.PropTypes.oneOfType([_react.PropTypes.number,_victoryCore.PropTypes.domain])}),_react.PropTypes.number]),events:_react.PropTypes.arrayOf(_react.PropTypes.shape({childName:_react.PropTypes.oneOfType([_react.PropTypes.string,_react.PropTypes.array]),target:_react.PropTypes.string,eventKey:_react.PropTypes.oneOfType([_react.PropTypes.array,_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,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})]),scale:_react.PropTypes.oneOfType([_victoryCore.PropTypes.scale,_react.PropTypes.shape({x:_victoryCore.PropTypes.scale,y:_victoryCore.PropTypes.scale})]),standalone:_react.PropTypes.bool,style:_react.PropTypes.object,theme:_react.PropTypes.object,width:_victoryCore.PropTypes.nonNegative,modifyChildren:_react.PropTypes.func};VictoryChart.defaultProps={standalone:true,containerComponent:_react2.default.createElement(_victoryCore.VictoryContainer,null),groupComponent:_react2.default.createElement("g",null),theme:_victoryCore.VictoryTheme.grayscale,defaultAxes:{independent:_react2.default.createElement(_victoryAxis2.default,null),dependent:_react2.default.createElement(_victoryAxis2.default,{dependentAxis:true})}};exports.default=VictoryChart; | ||
}}]);return VictoryChart;}(_react2.default.Component);VictoryChart.displayName="VictoryChart";VictoryChart.propTypes={animate:_react.PropTypes.object,children:_react2.default.PropTypes.oneOfType([_react2.default.PropTypes.arrayOf(_react2.default.PropTypes.node),_react2.default.PropTypes.node]),containerComponent:_react.PropTypes.element,defaultAxes:_react.PropTypes.shape({independent:_react.PropTypes.element,dependent:_react.PropTypes.element}),domain:_react.PropTypes.oneOfType([_victoryCore.PropTypes.domain,_react.PropTypes.shape({x:_victoryCore.PropTypes.domain,y:_victoryCore.PropTypes.domain})]),domainPadding:_react.PropTypes.oneOfType([_react.PropTypes.shape({x:_react.PropTypes.oneOfType([_react.PropTypes.number,_victoryCore.PropTypes.domain]),y:_react.PropTypes.oneOfType([_react.PropTypes.number,_victoryCore.PropTypes.domain])}),_react.PropTypes.number]),events:_react.PropTypes.arrayOf(_react.PropTypes.shape({childName:_react.PropTypes.oneOfType([_react.PropTypes.string,_react.PropTypes.array]),target:_react.PropTypes.string,eventKey:_react.PropTypes.oneOfType([_react.PropTypes.array,_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,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})]),scale:_react.PropTypes.oneOfType([_victoryCore.PropTypes.scale,_react.PropTypes.shape({x:_victoryCore.PropTypes.scale,y:_victoryCore.PropTypes.scale})]),sharedEvents:_react.PropTypes.shape({events:_react.PropTypes.array,getEventState:_react.PropTypes.func}),standalone:_react.PropTypes.bool,style:_react.PropTypes.object,theme:_react.PropTypes.object,width:_victoryCore.PropTypes.nonNegative,modifyChildren:_react.PropTypes.func};VictoryChart.defaultProps={standalone:true,containerComponent:_react2.default.createElement(_victoryCore.VictoryContainer,null),groupComponent:_react2.default.createElement("g",null),theme:_victoryCore.VictoryTheme.grayscale,defaultAxes:{independent:_react2.default.createElement(_victoryAxis2.default,null),dependent:_react2.default.createElement(_victoryAxis2.default,{dependentAxis:true})}};VictoryChart.expectedComponents=["groupComponent","containerComponent"];exports.default=VictoryChart; |
@@ -208,9 +208,8 @@ Object.defineProperty(exports,"__esModule",{value:true});var _pick2=require("lodash/pick");var _pick3=_interopRequireDefault(_pick2);var _flatten2=require("lodash/flatten");var _flatten3=_interopRequireDefault(_flatten2);var _isArray2=require("lodash/isArray");var _isArray3=_interopRequireDefault(_isArray2);var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _omit2=require("lodash/omit");var _omit3=_interopRequireDefault(_omit2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2); | ||
var baseDataStyle=(0,_defaults3.default)({},stylesFromData,style); | ||
return _victoryCore.Helpers.evaluateStyle(baseDataStyle,datum); | ||
return(0,_defaults3.default)({},stylesFromData,style); | ||
}, | ||
getLabelText:function getLabelText(props,datum,index){ | ||
return datum.label||(Array.isArray(props.labels)? | ||
props.labels[index]:_victoryCore.Helpers.evaluateProp(props.labels,datum)); | ||
return datum.label||Array.isArray(props.labels)? | ||
props.labels[index]:props.labels; | ||
}, | ||
@@ -220,7 +219,6 @@ | ||
labelStyle=labelStyle||{};var | ||
datum=dataProps.datum,size=dataProps.size,style=dataProps.style; | ||
size=dataProps.size,style=dataProps.style; | ||
var matchedStyle=(0,_pick3.default)(style,["opacity","fill"]); | ||
var padding=labelStyle.padding||size*0.25; | ||
var baseLabelStyle=(0,_defaults3.default)({},labelStyle,matchedStyle,{padding:padding}); | ||
return _victoryCore.Helpers.evaluateStyle(baseLabelStyle,datum)||{}; | ||
return(0,_defaults3.default)({},labelStyle,matchedStyle,{padding:padding})||{}; | ||
}}; |
@@ -136,2 +136,3 @@ Object.defineProperty(exports,"__esModule",{value:true});var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2);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;};}(); | ||
_this.setAnimationState=_wrapper2.default.setAnimationState.bind(_this); | ||
_this.events=_wrapper2.default.getAllEvents(props); | ||
}return _this; | ||
@@ -142,2 +143,3 @@ }_createClass(VictoryGroup,[{key:"componentWillMount",value:function componentWillMount() | ||
this.getContainerRef=function(component){return _this2.containerRef=component;}; | ||
this.events=_wrapper2.default.getAllEvents(this.props); | ||
}},{key:"componentWillReceiveProps",value:function componentWillReceiveProps( | ||
@@ -149,2 +151,3 @@ | ||
} | ||
this.events=_wrapper2.default.getAllEvents(nextProps); | ||
}},{key:"getCalculatedProps",value:function getCalculatedProps( | ||
@@ -155,3 +158,3 @@ | ||
var horizontal=modifiedProps.horizontal||childComponents.every( | ||
function(component){return component.props.horizontal;}); | ||
function(component){return component.props&&component.props.horizontal;}); | ||
@@ -307,3 +310,3 @@ var datasets=_wrapper2.default.getDataFromChildren(modifiedProps); | ||
var modifiedProps=_victoryCore.Helpers.modifyProps(props,fallbackProps,"group");var | ||
theme=modifiedProps.theme,standalone=modifiedProps.standalone,events=modifiedProps.events,eventKey=modifiedProps.eventKey; | ||
theme=modifiedProps.theme,standalone=modifiedProps.standalone,eventKey=modifiedProps.eventKey; | ||
var defaultStyle=theme&&theme.group&&theme.group.style?theme.group.style:{}; | ||
@@ -321,5 +324,5 @@ var style=_victoryCore.Helpers.getStyles(modifiedProps.style,defaultStyle,"auto","100%"); | ||
this.getContainer(modifiedProps,calculatedProps):group; | ||
if(events){ | ||
if(this.events){ | ||
return( | ||
_react2.default.createElement(_victoryCore.VictorySharedEvents,{events:events,eventKey:eventKey,container:container}, | ||
_react2.default.createElement(_victoryCore.VictorySharedEvents,{events:this.events,eventKey:eventKey,container:container}, | ||
newChildren)); | ||
@@ -326,0 +329,0 @@ |
@@ -14,3 +14,2 @@ Object.defineProperty(exports,"__esModule",{value:true});var _last2=require("lodash/last");var _last3=_interopRequireDefault(_last2);var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _sortBy2=require("lodash/sortBy");var _sortBy3=_interopRequireDefault(_sortBy2); | ||
props,interpolation=_props.interpolation,label=_props.label,width=_props.width,height=_props.height,events=_props.events,sharedEvents=_props.sharedEvents; | ||
var dataStyle=_victoryCore.Helpers.evaluateStyle(style.data,dataset); | ||
var childProps={parent:{ | ||
@@ -22,8 +21,7 @@ style:style.parent,scale:scale,data:dataset,height:height,width:width}}; | ||
scale:scale, | ||
interpolation:_victoryCore.Helpers.evaluateProp(interpolation,dataset), | ||
style:dataStyle, | ||
interpolation:interpolation, | ||
style:style.data, | ||
data:dataSegments[index]}; | ||
var text=index===dataSegments.length-1? | ||
_victoryCore.Helpers.evaluateProp(label,dataset):undefined; | ||
var text=index===dataSegments.length-1?label:undefined; | ||
var addLabels=text!==undefined&&text!==null||events||sharedEvents; | ||
@@ -42,4 +40,3 @@ var labelProps=addLabels? | ||
var lastData=(0,_last3.default)((0,_last3.default)(dataSegments)); | ||
var baseLabelStyle=_victoryCore.Helpers.evaluateStyle(style.labels,dataset)||{}; | ||
var labelStyle=this.getLabelStyle(baseLabelStyle,dataStyle); | ||
var labelStyle=this.getLabelStyle(style.labels,dataStyle); | ||
@@ -46,0 +43,0 @@ return{ |
@@ -76,4 +76,3 @@ Object.defineProperty(exports,"__esModule",{value:true});var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _omit2=require("lodash/omit");var _omit3=_interopRequireDefault(_omit2);var _pick2=require("lodash/pick");var _pick3=_interopRequireDefault(_pick2);var _values2=require("lodash/values");var _values3=_interopRequireDefault(_values2); | ||
var baseDataStyle=(0,_defaults3.default)({},stylesFromData,style); | ||
return _victoryCore.Helpers.evaluateStyle(baseDataStyle,datum); | ||
return(0,_defaults3.default)({},stylesFromData,style); | ||
}, | ||
@@ -83,11 +82,10 @@ | ||
return datum.label||(Array.isArray(props.labels)? | ||
props.labels[index]:_victoryCore.Helpers.evaluateProp(props.labels,datum)); | ||
props.labels[index]:props.labels); | ||
}, | ||
getLabelStyle:function getLabelStyle(labelStyle,dataProps){var | ||
datum=dataProps.datum,size=dataProps.size,style=dataProps.style; | ||
size=dataProps.size,style=dataProps.style; | ||
var matchedStyle=(0,_pick3.default)(style,["opacity","fill"]); | ||
var padding=labelStyle.padding||size*0.25; | ||
var baseLabelStyle=(0,_defaults3.default)({},labelStyle,matchedStyle,{padding:padding}); | ||
return _victoryCore.Helpers.evaluateStyle(baseLabelStyle,datum); | ||
return(0,_defaults3.default)({},labelStyle,matchedStyle,{padding:padding}); | ||
}, | ||
@@ -99,4 +97,3 @@ | ||
} | ||
var symbol=data.symbol||props.symbol; | ||
return _victoryCore.Helpers.evaluateProp(symbol,data); | ||
return data.symbol||props.symbol; | ||
}, | ||
@@ -121,13 +118,11 @@ | ||
getSize:function getSize(data,props,calculatedValues){ | ||
var size=void 0; | ||
if(data.size){ | ||
size=typeof data.size==="function"?data.size:Math.max(data.size,1); | ||
return typeof data.size==="function"?data.size:Math.max(data.size,1); | ||
}else if(typeof props.size==="function"){ | ||
size=props.size; | ||
return props.size; | ||
}else if(data[calculatedValues.z]){ | ||
size=this.getBubbleSize(data,props,calculatedValues); | ||
return this.getBubbleSize(data,props,calculatedValues); | ||
}else{ | ||
size=Math.max(props.size,1); | ||
return Math.max(props.size,1); | ||
} | ||
return _victoryCore.Helpers.evaluateProp(size,data); | ||
}}; |
@@ -120,5 +120,10 @@ Object.defineProperty(exports,"__esModule",{value:true});var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2);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;};}(); | ||
_this.setAnimationState=_wrapper2.default.setAnimationState.bind(_this); | ||
_this.events=_wrapper2.default.getAllEvents(props); | ||
}return _this; | ||
}_createClass(VictoryStack,[{key:"componentWillReceiveProps",value:function componentWillReceiveProps( | ||
}_createClass(VictoryStack,[{key:"componentWillMount",value:function componentWillMount() | ||
{ | ||
this.events=_wrapper2.default.getAllEvents(this.props); | ||
}},{key:"componentWillReceiveProps",value:function componentWillReceiveProps( | ||
nextProps){ | ||
@@ -128,2 +133,3 @@ if(this.props.animate){ | ||
} | ||
this.events=_wrapper2.default.getAllEvents(nextProps); | ||
}},{key:"getCalculatedProps",value:function getCalculatedProps( | ||
@@ -255,3 +261,3 @@ | ||
var modifiedProps=_victoryCore.Helpers.modifyProps(props,fallbackProps,"stack");var | ||
theme=modifiedProps.theme,standalone=modifiedProps.standalone,events=modifiedProps.events,eventKey=modifiedProps.eventKey; | ||
theme=modifiedProps.theme,standalone=modifiedProps.standalone,eventKey=modifiedProps.eventKey; | ||
var fallbackStyle=theme&&theme.stack&&theme.stack.style? | ||
@@ -265,5 +271,5 @@ theme.stack.style:{}; | ||
var container=standalone?this.getContainer(modifiedProps,calculatedProps):group; | ||
if(events){ | ||
if(this.events){ | ||
return( | ||
_react2.default.createElement(_victoryCore.VictorySharedEvents,{events:events,eventKey:eventKey,container:container}, | ||
_react2.default.createElement(_victoryCore.VictorySharedEvents,{events:this.events,eventKey:eventKey,container:container}, | ||
newChildren)); | ||
@@ -270,0 +276,0 @@ |
@@ -40,4 +40,4 @@ Object.defineProperty(exports,"__esModule",{value:true});var _without2=require("lodash/without");var _without3=_interopRequireDefault(_without2);var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _omit2=require("lodash/omit");var _omit3=_interopRequireDefault(_omit2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2); | ||
x:x,y:y,text:text,index:index,scale:scale,datum:datum,data:data, | ||
flyoutStyle:_victoryCore.Helpers.evaluateStyle(style.flyout,datum), | ||
style:_victoryCore.Helpers.evaluateStyle(style.labels,datum)}; | ||
flyoutStyle:style.flyout, | ||
style:style.labels}; | ||
@@ -93,4 +93,3 @@ }, | ||
var baseDataStyle=(0,_defaults3.default)({},stylesFromData,style); | ||
return _victoryCore.Helpers.evaluateStyle(baseDataStyle,datum); | ||
return(0,_defaults3.default)({},stylesFromData,style); | ||
}, | ||
@@ -100,3 +99,3 @@ | ||
return datum.label||(Array.isArray(props.labels)? | ||
props.labels[index]:_victoryCore.Helpers.evaluateProp(props.labels,datum)); | ||
props.labels[index]:props.labels); | ||
}}; |
@@ -86,13 +86,12 @@ Object.defineProperty(exports,"__esModule",{value:true});var _without2=require("lodash/without");var _without3=_interopRequireDefault(_without2);var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _omit2=require("lodash/omit");var _omit3=_interopRequireDefault(_omit2); | ||
var baseDataStyle=(0,_defaults3.default)({},stylesFromData,style); | ||
return _victoryCore.Helpers.evaluateStyle(baseDataStyle,datum); | ||
return(0,_defaults3.default)({},stylesFromData,style); | ||
}, | ||
getLabelText:function getLabelText(props,datum,index){ | ||
return datum.label||(Array.isArray(props.labels)? | ||
props.labels[index]:_victoryCore.Helpers.evaluateProp(props.labels,datum)); | ||
return datum.label||Array.isArray(props.labels)? | ||
props.labels[index]:props.labels; | ||
}, | ||
getLabelStyle:function getLabelStyle(style,datum){ | ||
var labelStyle=(0,_defaults3.default)({},{ | ||
return(0,_defaults3.default)({},{ | ||
angle:datum.angle, | ||
@@ -102,3 +101,2 @@ textAnchor:datum.textAnchor, | ||
style); | ||
return _victoryCore.Helpers.evaluateStyle(labelStyle,datum); | ||
}}; |
@@ -69,2 +69,12 @@ Object.defineProperty(exports,"__esModule",{value:true});var _some2=require("lodash/some");var _some3=_interopRequireDefault(_some2);var _uniq2=require("lodash/uniq");var _uniq3=_interopRequireDefault(_uniq2);var _partialRight2=require("lodash/partialRight");var _partialRight3=_interopRequireDefault(_partialRight2);var _isFunction2=require("lodash/isFunction");var _isFunction3=_interopRequireDefault(_isFunction2);var _flatten2=require("lodash/flatten");var _flatten3=_interopRequireDefault(_flatten2);var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2); | ||
getAllEvents:function getAllEvents(props){ | ||
var components=["groupComponent","containerComponent"]; | ||
this.componentEvents=_victoryCore.Events.getComponentEvents(props,components); | ||
if(Array.isArray(this.componentEvents)){var _componentEvents; | ||
return Array.isArray(props.events)? | ||
(_componentEvents=this.componentEvents).concat.apply(_componentEvents,_toConsumableArray(props.events)):this.componentEvents; | ||
} | ||
return props.events; | ||
}, | ||
getAnimationProps:function getAnimationProps(props,child,index){var _this2=this; | ||
@@ -153,8 +163,8 @@ if(!props.animate){ | ||
var dataArrLength=0; | ||
while(childrenLength>0){ | ||
var child=children[--childrenLength]; | ||
if(child.type&&(0,_isFunction3.default)(child.type.getData)){ | ||
dataArr[dataArrLength++]=child.props&&child.type.getData(child.props); | ||
if(child.type&&child.type.role==="axis"){ | ||
dataArrLength=dataArrLength; | ||
}else if(child.type&&child.type.role!=="axis"&&(0,_isFunction3.default)(child.type.getData)){ | ||
dataArr[dataArrLength++]=child.type.getData(child.props); | ||
}else if(child.props&&child.props.children){ | ||
@@ -161,0 +171,0 @@ var newChildren=_react2.default.Children.toArray(child.props.children); |
@@ -13,2 +13,5 @@ Object.defineProperty(exports,"__esModule",{value:true});var _victoryChart=require("./components/victory-chart/victory-chart");Object.defineProperty(exports,"VictoryChart",{enumerable:true,get:function get(){return _interopRequireDefault(_victoryChart).default;}});var _victoryLine=require("./components/victory-line/victory-line");Object.defineProperty(exports,"VictoryLine",{enumerable:true,get:function get(){return _interopRequireDefault(_victoryLine). | ||
default;}});var _victorySelectionContainer=require("./components/victory-selection-container/victory-selection-container");Object.defineProperty(exports,"VictorySelectionContainer",{enumerable:true,get:function get(){return _interopRequireDefault(_victorySelectionContainer). | ||
default;}});var _victoryCandlestick=require("./components/victory-candlestick/victory-candlestick");Object.defineProperty(exports,"VictoryCandlestick",{enumerable:true,get:function get(){return _interopRequireDefault(_victoryCandlestick). | ||
@@ -15,0 +18,0 @@ |
{ | ||
"name": "victory-chart", | ||
"version": "14.0.4", | ||
"version": "15.0.0", | ||
"description": "Chart Component for Victory", | ||
@@ -32,3 +32,3 @@ "main": "lib/index.js", | ||
"lodash": "^4.12.0", | ||
"victory-core": "^10.0.0" | ||
"victory-core": "^11.0.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "devDependencies": { |
@@ -16,4 +16,4 @@ import { assign, last } from "lodash"; | ||
scale, | ||
interpolation: Helpers.evaluateProp(interpolation, data), | ||
style: Helpers.evaluateStyle(style.data, data) | ||
interpolation, | ||
style: style.data | ||
}; | ||
@@ -28,5 +28,4 @@ | ||
const text = Helpers.evaluateProp(label, data); | ||
if (text !== undefined && text !== null || props.events || props.sharedEvents) { | ||
baseProps.all.labels = this.getLabelProps(dataProps, text, style); | ||
if (label !== undefined && label !== null || props.events || props.sharedEvents) { | ||
baseProps.all.labels = this.getLabelProps(dataProps, label, style); | ||
} | ||
@@ -48,3 +47,3 @@ | ||
y0: lastData ? scale.y(lastData.y0) : 0, | ||
style: labelStyle, | ||
style: calculatedStyle.labels, | ||
textAnchor: labelStyle.textAnchor || "start", | ||
@@ -51,0 +50,0 @@ verticalAnchor: labelStyle.verticalAnchor || "middle", |
@@ -12,2 +12,16 @@ import { includes, defaults, defaultsDeep, isFunction, range, without } from "lodash"; | ||
export default { | ||
evaluateProp(prop, data, index) { | ||
return isFunction(prop) ? prop(data, index) : prop; | ||
}, | ||
evaluateStyle(style, data, index) { | ||
if (!style || !Object.keys(style).some((value) => isFunction(style[value]))) { | ||
return style; | ||
} | ||
return Object.keys(style).reduce((prev, curr) => { | ||
prev[curr] = this.evaluateProp(style[curr], data, index); | ||
return prev; | ||
}, {}); | ||
}, | ||
// exposed for use by VictoryChart | ||
@@ -142,5 +156,5 @@ getDomain(props, axis) { | ||
return { | ||
tickStyle: Helpers.evaluateStyle(style.ticks, tick, index), | ||
labelStyle: Helpers.evaluateStyle(style.tickLabels, tick, index), | ||
gridStyle: Helpers.evaluateStyle(style.grid, tick, index) | ||
tickStyle: this.evaluateStyle(style.ticks, tick, index), | ||
labelStyle: this.evaluateStyle(style.tickLabels, tick, index), | ||
gridStyle: this.evaluateStyle(style.grid, tick, index) | ||
}; | ||
@@ -330,3 +344,3 @@ }, | ||
const tick = stringTicks ? props.tickValues[data - 1] : data; | ||
const tickStyle = Helpers.evaluateStyle(style.ticks, tick); | ||
const tickStyle = this.evaluateStyle(style.ticks, tick); | ||
return tickStyle.size || 0; | ||
@@ -333,0 +347,0 @@ }); |
@@ -51,7 +51,7 @@ import { assign, defaults, omit } from "lodash"; | ||
]); | ||
return Helpers.evaluateStyle(defaults({}, styleData, baseStyle), datum); | ||
return defaults({}, styleData, baseStyle); | ||
}, | ||
getLabelStyle(style, datum) { | ||
const labelStyle = defaults({}, { | ||
return defaults({}, { | ||
angle: datum.angle, | ||
@@ -61,3 +61,2 @@ textAnchor: datum.textAnchor, | ||
}, style); | ||
return Helpers.evaluateStyle(labelStyle, datum); | ||
}, | ||
@@ -67,3 +66,3 @@ | ||
return datum.label || (Array.isArray(props.labels) ? | ||
props.labels[index] : Helpers.evaluateProp(props.labels, datum)); | ||
props.labels[index] : props.labels); | ||
}, | ||
@@ -70,0 +69,0 @@ |
@@ -152,4 +152,3 @@ import { assign, pick, omit, defaults } from "lodash"; | ||
const stroke = this.isTransparent(strokeColor) ? fill : strokeColor || "black"; | ||
const baseDataStyle = defaults({}, stylesFromData, {stroke, fill}, style); | ||
return Helpers.evaluateStyle(baseDataStyle, datum); | ||
return defaults({}, stylesFromData, {stroke, fill}, style); | ||
}, | ||
@@ -159,3 +158,3 @@ | ||
return datum.label || (Array.isArray(props.labels) ? | ||
props.labels[index] : Helpers.evaluateProp(props.labels, datum)); | ||
props.labels[index] : props.labels); | ||
}, | ||
@@ -165,8 +164,7 @@ | ||
labelStyle = labelStyle || {}; | ||
const { datum, size, style } = dataProps; | ||
const { size, style } = dataProps; | ||
const matchedStyle = pick(style, ["opacity", "fill"]); | ||
const padding = labelStyle.padding || size * 0.25; | ||
const baseLabelStyle = defaults({}, labelStyle, matchedStyle, {padding}); | ||
return Helpers.evaluateStyle(baseLabelStyle, datum); | ||
return defaults({}, labelStyle, matchedStyle, {padding}); | ||
} | ||
}; |
@@ -75,2 +75,6 @@ import { defaults } from "lodash"; | ||
]), | ||
sharedEvents: PropTypes.shape({ | ||
events: PropTypes.array, | ||
getEventState: PropTypes.func | ||
}), | ||
standalone: PropTypes.bool, | ||
@@ -94,4 +98,9 @@ style: PropTypes.object, | ||
static expectedComponents = [ | ||
"groupComponent", "containerComponent" | ||
]; | ||
constructor(props) { | ||
super(props); | ||
this.state = {}; | ||
if (props.animate) { | ||
@@ -105,5 +114,7 @@ this.state = { | ||
} | ||
this.events = Wrapper.getAllEvents(props); | ||
} | ||
componentWillMount() { | ||
this.events = Wrapper.getAllEvents(this.props); | ||
this.getContainerRef = (component) => this.containerRef = component; | ||
@@ -116,2 +127,3 @@ } | ||
} | ||
this.events = Wrapper.getAllEvents(nextProps); | ||
} | ||
@@ -279,3 +291,3 @@ | ||
const modifiedProps = Helpers.modifyProps(props, fallbackProps, "chart"); | ||
const { standalone, events, eventKey } = modifiedProps; | ||
const { standalone, eventKey } = modifiedProps; | ||
const childComponents = ChartHelpers.getChildComponents(modifiedProps, | ||
@@ -290,5 +302,5 @@ modifiedProps.defaultAxes); | ||
const container = standalone ? this.getContainer(modifiedProps, calculatedProps) : group; | ||
if (events) { | ||
if (this.events) { | ||
return ( | ||
<VictorySharedEvents events={events} eventKey={eventKey} container={container}> | ||
<VictorySharedEvents events={this.events} eventKey={eventKey} container={container}> | ||
{newChildren} | ||
@@ -295,0 +307,0 @@ </VictorySharedEvents> |
@@ -208,9 +208,8 @@ import { assign, omit, defaults, isArray, flatten, pick } from "lodash"; | ||
]); | ||
const baseDataStyle = defaults({}, stylesFromData, style); | ||
return Helpers.evaluateStyle(baseDataStyle, datum); | ||
return defaults({}, stylesFromData, style); | ||
}, | ||
getLabelText(props, datum, index) { | ||
return datum.label || (Array.isArray(props.labels) ? | ||
props.labels[index] : Helpers.evaluateProp(props.labels, datum)); | ||
return datum.label || Array.isArray(props.labels) ? | ||
props.labels[index] : props.labels; | ||
}, | ||
@@ -220,8 +219,7 @@ | ||
labelStyle = labelStyle || {}; | ||
const { datum, size, style } = dataProps; | ||
const { size, style } = dataProps; | ||
const matchedStyle = pick(style, ["opacity", "fill"]); | ||
const padding = labelStyle.padding || size * 0.25; | ||
const baseLabelStyle = defaults({}, labelStyle, matchedStyle, {padding}); | ||
return Helpers.evaluateStyle(baseLabelStyle, datum) || {}; | ||
return defaults({}, labelStyle, matchedStyle, {padding}) || {}; | ||
} | ||
}; |
@@ -136,2 +136,3 @@ import { assign, defaults } from "lodash"; | ||
this.setAnimationState = Wrapper.setAnimationState.bind(this); | ||
this.events = Wrapper.getAllEvents(props); | ||
} | ||
@@ -142,2 +143,3 @@ } | ||
this.getContainerRef = (component) => this.containerRef = component; | ||
this.events = Wrapper.getAllEvents(this.props); | ||
} | ||
@@ -149,2 +151,3 @@ | ||
} | ||
this.events = Wrapper.getAllEvents(nextProps); | ||
} | ||
@@ -155,3 +158,3 @@ | ||
const horizontal = modifiedProps.horizontal || childComponents.every( | ||
(component) => component.props.horizontal | ||
(component) => component.props && component.props.horizontal | ||
); | ||
@@ -307,3 +310,3 @@ const datasets = Wrapper.getDataFromChildren(modifiedProps); | ||
const modifiedProps = Helpers.modifyProps(props, fallbackProps, "group"); | ||
const { theme, standalone, events, eventKey } = modifiedProps; | ||
const { theme, standalone, eventKey } = modifiedProps; | ||
const defaultStyle = theme && theme.group && theme.group.style ? theme.group.style : {}; | ||
@@ -321,5 +324,5 @@ const style = Helpers.getStyles(modifiedProps.style, defaultStyle, "auto", "100%"); | ||
this.getContainer(modifiedProps, calculatedProps) : group; | ||
if (events) { | ||
if (this.events) { | ||
return ( | ||
<VictorySharedEvents events={events} eventKey={eventKey} container={container}> | ||
<VictorySharedEvents events={this.events} eventKey={eventKey} container={container}> | ||
{newChildren} | ||
@@ -326,0 +329,0 @@ </VictorySharedEvents> |
@@ -14,3 +14,2 @@ import { sortBy, defaults, last } from "lodash"; | ||
const {interpolation, label, width, height, events, sharedEvents} = props; | ||
const dataStyle = Helpers.evaluateStyle(style.data, dataset); | ||
const childProps = { parent: { | ||
@@ -22,8 +21,7 @@ style: style.parent, scale, data: dataset, height, width | ||
scale, | ||
interpolation: Helpers.evaluateProp(interpolation, dataset), | ||
style: dataStyle, | ||
interpolation, | ||
style: style.data, | ||
data: dataSegments[index] | ||
}; | ||
const text = index === dataSegments.length - 1 ? | ||
Helpers.evaluateProp(label, dataset) : undefined; | ||
const text = index === dataSegments.length - 1 ? label : undefined; | ||
const addLabels = (text !== undefined && text !== null) || events || sharedEvents; | ||
@@ -42,4 +40,3 @@ const labelProps = addLabels ? | ||
const lastData = last(last(dataSegments)); | ||
const baseLabelStyle = Helpers.evaluateStyle(style.labels, dataset) || {}; | ||
const labelStyle = this.getLabelStyle(baseLabelStyle, dataStyle); | ||
const labelStyle = this.getLabelStyle(style.labels, dataStyle); | ||
@@ -46,0 +43,0 @@ return { |
@@ -76,4 +76,3 @@ import { values, pick, omit, defaults } from "lodash"; | ||
]); | ||
const baseDataStyle = defaults({}, stylesFromData, style); | ||
return Helpers.evaluateStyle(baseDataStyle, datum); | ||
return defaults({}, stylesFromData, style); | ||
}, | ||
@@ -83,11 +82,10 @@ | ||
return datum.label || (Array.isArray(props.labels) ? | ||
props.labels[index] : Helpers.evaluateProp(props.labels, datum)); | ||
props.labels[index] : props.labels); | ||
}, | ||
getLabelStyle(labelStyle, dataProps) { | ||
const { datum, size, style } = dataProps; | ||
const { size, style } = dataProps; | ||
const matchedStyle = pick(style, ["opacity", "fill"]); | ||
const padding = labelStyle.padding || size * 0.25; | ||
const baseLabelStyle = defaults({}, labelStyle, matchedStyle, {padding}); | ||
return Helpers.evaluateStyle(baseLabelStyle, datum); | ||
return defaults({}, labelStyle, matchedStyle, {padding}); | ||
}, | ||
@@ -99,4 +97,3 @@ | ||
} | ||
const symbol = data.symbol || props.symbol; | ||
return Helpers.evaluateProp(symbol, data); | ||
return data.symbol || props.symbol; | ||
}, | ||
@@ -121,14 +118,12 @@ | ||
getSize(data, props, calculatedValues) { | ||
let size; | ||
if (data.size) { | ||
size = typeof data.size === "function" ? data.size : Math.max(data.size, 1); | ||
return typeof data.size === "function" ? data.size : Math.max(data.size, 1); | ||
} else if (typeof props.size === "function") { | ||
size = props.size; | ||
return props.size; | ||
} else if (data[calculatedValues.z]) { | ||
size = this.getBubbleSize(data, props, calculatedValues); | ||
return this.getBubbleSize(data, props, calculatedValues); | ||
} else { | ||
size = Math.max(props.size, 1); | ||
return Math.max(props.size, 1); | ||
} | ||
return Helpers.evaluateProp(size, data); | ||
} | ||
}; |
@@ -120,5 +120,10 @@ import { assign, defaults } from "lodash"; | ||
this.setAnimationState = Wrapper.setAnimationState.bind(this); | ||
this.events = Wrapper.getAllEvents(props); | ||
} | ||
} | ||
componentWillMount() { | ||
this.events = Wrapper.getAllEvents(this.props); | ||
} | ||
componentWillReceiveProps(nextProps) { | ||
@@ -128,2 +133,3 @@ if (this.props.animate) { | ||
} | ||
this.events = Wrapper.getAllEvents(nextProps); | ||
} | ||
@@ -255,3 +261,3 @@ | ||
const modifiedProps = Helpers.modifyProps(props, fallbackProps, "stack"); | ||
const { theme, standalone, events, eventKey} = modifiedProps; | ||
const { theme, standalone, eventKey} = modifiedProps; | ||
const fallbackStyle = theme && theme.stack && theme.stack.style ? | ||
@@ -265,5 +271,5 @@ theme.stack.style : {}; | ||
const container = standalone ? this.getContainer(modifiedProps, calculatedProps) : group; | ||
if (events) { | ||
if (this.events) { | ||
return ( | ||
<VictorySharedEvents events={events} eventKey={eventKey} container={container}> | ||
<VictorySharedEvents events={this.events} eventKey={eventKey} container={container}> | ||
{newChildren} | ||
@@ -270,0 +276,0 @@ </VictorySharedEvents> |
@@ -40,4 +40,4 @@ import { assign, omit, defaults, without } from "lodash"; | ||
x, y, text, index, scale, datum, data, | ||
flyoutStyle: Helpers.evaluateStyle(style.flyout, datum), | ||
style: Helpers.evaluateStyle(style.labels, datum) | ||
flyoutStyle: style.flyout, | ||
style: style.labels | ||
}; | ||
@@ -93,4 +93,3 @@ }, | ||
]); | ||
const baseDataStyle = defaults({}, stylesFromData, style); | ||
return Helpers.evaluateStyle(baseDataStyle, datum); | ||
return defaults({}, stylesFromData, style); | ||
}, | ||
@@ -100,4 +99,4 @@ | ||
return datum.label || (Array.isArray(props.labels) ? | ||
props.labels[index] : Helpers.evaluateProp(props.labels, datum)); | ||
props.labels[index] : props.labels); | ||
} | ||
}; |
@@ -86,13 +86,12 @@ import { omit, defaults, without } from "lodash"; | ||
]); | ||
const baseDataStyle = defaults({}, stylesFromData, style); | ||
return Helpers.evaluateStyle(baseDataStyle, datum); | ||
return defaults({}, stylesFromData, style); | ||
}, | ||
getLabelText(props, datum, index) { | ||
return datum.label || (Array.isArray(props.labels) ? | ||
props.labels[index] : Helpers.evaluateProp(props.labels, datum)); | ||
return datum.label || Array.isArray(props.labels) ? | ||
props.labels[index] : props.labels; | ||
}, | ||
getLabelStyle(style, datum) { | ||
const labelStyle = defaults({}, { | ||
return defaults({}, { | ||
angle: datum.angle, | ||
@@ -102,4 +101,3 @@ textAnchor: datum.textAnchor, | ||
}, style); | ||
return Helpers.evaluateStyle(labelStyle, datum); | ||
} | ||
}; |
import { assign, defaults, flatten, isFunction, partialRight, uniq, some } from "lodash"; | ||
import React from "react"; | ||
import Axis from "./axis"; | ||
import { Style, Transitions, Collection, Data, Domain } from "victory-core"; | ||
import { Style, Transitions, Collection, Data, Domain, Events } from "victory-core"; | ||
@@ -69,2 +69,12 @@ | ||
getAllEvents(props) { | ||
const components = ["groupComponent", "containerComponent"]; | ||
this.componentEvents = Events.getComponentEvents(props, components); | ||
if (Array.isArray(this.componentEvents)) { | ||
return Array.isArray(props.events) ? | ||
this.componentEvents.concat(...props.events) : this.componentEvents; | ||
} | ||
return props.events; | ||
}, | ||
getAnimationProps(props, child, index) { | ||
@@ -137,3 +147,3 @@ if (!props.animate) { | ||
getDataFromChildren(props, childComponents) { | ||
getDataFromChildren(props, childComponents) { // eslint-disable-line max-statements | ||
const getData = (childProps) => { | ||
@@ -154,8 +164,8 @@ const data = Data.getData(childProps); | ||
let dataArrLength = 0; | ||
while (childrenLength > 0) { | ||
const child = children[--childrenLength]; | ||
if (child.type && isFunction(child.type.getData)) { | ||
dataArr[dataArrLength++] = child.props && child.type.getData(child.props); | ||
if (child.type && child.type.role === "axis") { | ||
dataArrLength = dataArrLength; | ||
} else if (child.type && child.type.role !== "axis" && isFunction(child.type.getData)) { | ||
dataArr[dataArrLength++] = child.type.getData(child.props); | ||
} else if (child.props && child.props.children) { | ||
@@ -162,0 +172,0 @@ const newChildren = React.Children.toArray(child.props.children); |
@@ -16,3 +16,6 @@ export { default as VictoryChart } from "./components/victory-chart/victory-chart"; | ||
export { | ||
default as VictorySelectionContainer | ||
} from "./components/victory-selection-container/victory-selection-container"; | ||
export { | ||
default as VictoryCandlestick | ||
} from "./components/victory-candlestick/victory-candlestick"; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1613733
62
28695
+ Addedvictory-core@11.0.1(transitive)
- Removedvictory-core@10.0.3(transitive)
Updatedvictory-core@^11.0.0