Skip to content

Commit

Permalink
feat(chart): remove initial zeroing on chart data to allow server render
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmeinke committed Mar 12, 2016
1 parent ca0f954 commit 1136aa8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/BarChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@ const BarChart = createClass({

getInitialState () {
return {
bars: this.props.bars.map( b => ({ ...b, value: 0 })),
barHeight: ( this.props.height - this.props.spacing * ( this.props.bars.length - 1 )) / this.props.bars.length,
bars: this.relativeBars( this.props.bars ),
};
},

componentDidMount () {
this.animateBars( this.state.bars, this.relativeBars( this.props.bars ));
},

componentWillReceiveProps ({ bars }) {
const relativeBars = this.relativeBars( bars );
if ( JSON.stringify( relativeBars ) !== JSON.stringify( this.state.bars )) {
Expand Down

0 comments on commit 1136aa8

Please sign in to comment.