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