Use consistent function definition order
This commit is contained in:
parent
790156f28d
commit
e29c2ed1b7
|
@ -20,12 +20,6 @@ var BarChart = React.createClass({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
calculateViewBoxWidth: function() {
|
|
||||||
this.setState({
|
|
||||||
canvasWidth: this.refs.svg.getDOMNode().offsetWidth
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
this.calculateViewBoxWidth();
|
this.calculateViewBoxWidth();
|
||||||
window.addEventListener('resize', this.calculateViewBoxWidth);
|
window.addEventListener('resize', this.calculateViewBoxWidth);
|
||||||
|
@ -38,6 +32,12 @@ var BarChart = React.createClass({
|
||||||
}, this.fetchData);
|
}, this.fetchData);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
calculateViewBoxWidth: function() {
|
||||||
|
this.setState({
|
||||||
|
canvasWidth: this.refs.svg.getDOMNode().offsetWidth
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
handleFilter: function(thing, i) {
|
handleFilter: function(thing, i) {
|
||||||
if (thing === 'item' && this.props.items[i] !== this.state.item) {
|
if (thing === 'item' && this.props.items[i] !== this.state.item) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -198,7 +198,7 @@ var Bar = React.createClass({
|
||||||
anim.setAttributeNS(null, 'attributeName', 'width');
|
anim.setAttributeNS(null, 'attributeName', 'width');
|
||||||
anim.setAttributeNS(null, 'from', this.state.lastw);
|
anim.setAttributeNS(null, 'from', this.state.lastw);
|
||||||
anim.setAttributeNS(null, 'to', this.props.width);
|
anim.setAttributeNS(null, 'to', this.props.width);
|
||||||
anim.setAttributeNS(null, 'dur', '300ms');
|
anim.setAttributeNS(null, 'dur', '250ms');
|
||||||
anim.setAttributeNS(null, 'repeatCount', '1');
|
anim.setAttributeNS(null, 'repeatCount', '1');
|
||||||
bar.appendChild(anim);
|
bar.appendChild(anim);
|
||||||
anim.beginElement();
|
anim.beginElement();
|
||||||
|
|
|
@ -15,6 +15,12 @@ var StackedAreaChart = React.createClass({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
componentDidMount: function() {
|
||||||
|
this.fetchData();
|
||||||
|
this.calculateViewBoxWidth();
|
||||||
|
window.addEventListener('resize', this.calculateViewBoxWidth);
|
||||||
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
componentWillReceiveProps: function(newProps) {
|
||||||
this.setState({
|
this.setState({
|
||||||
'item': newProps.items[0],
|
'item': newProps.items[0],
|
||||||
|
@ -28,12 +34,6 @@ var StackedAreaChart = React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
|
||||||
this.fetchData();
|
|
||||||
this.calculateViewBoxWidth();
|
|
||||||
window.addEventListener('resize', this.calculateViewBoxWidth);
|
|
||||||
},
|
|
||||||
|
|
||||||
handleFilter: function(thing, i) {
|
handleFilter: function(thing, i) {
|
||||||
if (this.props.items[i] !== this.state.item) {
|
if (this.props.items[i] !== this.state.item) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
Loading…
Reference in New Issue