1
0
Fork 0
empact/app/jsx/charts/sac/area.jsx

31 lines
836 B
JavaScript

var Area = React.createClass({
mixins: [ChartAnimationMixin],
getInitialState: function() {
return {};
},
componentWillReceiveProps: function(newProps) {
this.setState({
lastd: this.props.d || newProps.d,
}, this.animateAll);
},
animateAll: function() {
this.clearAnimations(this.refs.path);
this.animate(this.refs.path, 'd', this.state.lastd, this.props.d);
},
render: function() {
return (
<path ref="path"
className={'path path-'+ this.props.i}
d={this.state.lastd || this.props.d}
fill={this.props.color}
onClick={this.props.onClick}
onMouseOver={this.props.onMouseOver}
shapeRendering="optimizeQuality" />
);
}
});