1
0
Fork 0

Fix barchart height

This commit is contained in:
Gregory Eremin 2015-03-18 16:09:27 +07:00
parent 70493d7b50
commit f34616bfad
1 changed files with 8 additions and 6 deletions

View File

@ -104,11 +104,6 @@ var BarChart = React.createClass({
}.bind(this)) }.bind(this))
.take(this.numElements) .take(this.numElements)
.value(); .value();
for (var i = points.length; i < this.numElements; i++) {
var point = {};
point[this.state.sort] = 0;
points.push(point);
}
this.setState({ this.setState({
points: points, points: points,
@ -138,6 +133,13 @@ var BarChart = React.createClass({
: 'org'); : 'org');
subject = this.getParams()[target]; subject = this.getParams()[target];
var points = _.clone(this.state.points);
if (points.length > 0) {
for (var i = points.length; i < this.numElements; i++) {
points.push({commits: 0, delta: 0});
}
}
return ( return (
<div className="barchart-container"> <div className="barchart-container">
<div className="whatsgoingon"> <div className="whatsgoingon">
@ -158,7 +160,7 @@ var BarChart = React.createClass({
<svg ref="svg" className="barchart" key="barchart-svg" <svg ref="svg" className="barchart" key="barchart-svg"
width="100%" height={this.height()} width="100%" height={this.height()}
viewBox={"0 0 "+ (this.state.canvasWidth || 0) + " "+ this.height()}> viewBox={"0 0 "+ (this.state.canvasWidth || 0) + " "+ this.height()}>
{this.state.points.map(this.renderBar)} {points.map(this.renderBar)}
</svg> </svg>
</div> </div>
); );