SAC done
This commit is contained in:
parent
299589b9c3
commit
dcc2402b9a
|
@ -273,13 +273,13 @@ var WeekIntervalSelector = React.createClass({
|
||||||
|
|
||||||
var weeksBefore = _(this.state.weeks)
|
var weeksBefore = _(this.state.weeks)
|
||||||
.filter(function(week) {
|
.filter(function(week) {
|
||||||
return week <= to;
|
return week < to;
|
||||||
})
|
})
|
||||||
.reverse()
|
.reverse()
|
||||||
.value();
|
.value();
|
||||||
var weeksAfter = _(this.state.weeks)
|
var weeksAfter = _(this.state.weeks)
|
||||||
.filter(function(week) {
|
.filter(function(week) {
|
||||||
return week >= from;
|
return week > from;
|
||||||
})
|
})
|
||||||
.reverse()
|
.reverse()
|
||||||
.value();
|
.value();
|
||||||
|
|
|
@ -64,10 +64,10 @@ var StackedAreaChart = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleClick: function(point) {
|
handleClick: function(item) {
|
||||||
var params = {org: this.getParams().org};
|
var params = {org: this.getParams().org};
|
||||||
params[this.state.item] = point.item;
|
params[this.state.item] = item;
|
||||||
this.transitionTo(this.state.item, params);
|
this.transitionTo(this.state.item, params, this.getQuery());
|
||||||
},
|
},
|
||||||
|
|
||||||
handleFocusIn: function(i) {
|
handleFocusIn: function(i) {
|
||||||
|
@ -83,6 +83,13 @@ var StackedAreaChart = React.createClass({
|
||||||
handleNewData: function() {
|
handleNewData: function() {
|
||||||
// Group commits by items
|
// Group commits by items
|
||||||
var weeksList = _(this.state.rawData).pluck('week').uniq().sort().reverse().take(this.maxWeeks).value();
|
var weeksList = _(this.state.rawData).pluck('week').uniq().sort().reverse().take(this.maxWeeks).value();
|
||||||
|
if (weeksList.length < 2) {
|
||||||
|
this.setState({
|
||||||
|
weeks: [],
|
||||||
|
state: 'newPoints'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var counts = _.reduce(this.state.rawData, function(res, el) {
|
var counts = _.reduce(this.state.rawData, function(res, el) {
|
||||||
if (weeksList.indexOf(el.week) === -1) {
|
if (weeksList.indexOf(el.week) === -1) {
|
||||||
|
@ -152,18 +159,6 @@ var StackedAreaChart = React.createClass({
|
||||||
return _.map(points, function(point, i) {
|
return _.map(points, function(point, i) {
|
||||||
point.x = i/(len-1)*maxWidth;
|
point.x = i/(len-1)*maxWidth;
|
||||||
point.y = maxHeight - point.point;
|
point.y = maxHeight - point.point;
|
||||||
|
|
||||||
if (point.x < 10) { // Radius
|
|
||||||
point.x = 10
|
|
||||||
} else if (point.x > maxWidth - 10) {
|
|
||||||
point.x = maxWidth - 10;
|
|
||||||
}
|
|
||||||
if (point.y < 10) {
|
|
||||||
point.y = 10;
|
|
||||||
} else if (point.y > maxHeight - 10) {
|
|
||||||
point.y = maxHeight - 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
return point;
|
return point;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -233,12 +228,30 @@ var StackedAreaChart = React.createClass({
|
||||||
if (dot.val === 0) {
|
if (dot.val === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var maxWidth = this.state.canvasWidth,
|
||||||
|
maxHeight = this.height,
|
||||||
|
radius = 10,
|
||||||
|
x = dot.x,
|
||||||
|
y = dot.y;
|
||||||
|
|
||||||
|
if (x < radius) {
|
||||||
|
x = radius
|
||||||
|
} else if (x > maxWidth - radius) {
|
||||||
|
x = maxWidth - radius;
|
||||||
|
}
|
||||||
|
if (y < radius) {
|
||||||
|
y = radius;
|
||||||
|
} else if (y > maxHeight - radius) {
|
||||||
|
y = maxHeight - radius;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dot key={'dot-'+ i +'-'+ j}
|
<Dot key={'dot-'+ i +'-'+ j}
|
||||||
item={item} i={i}
|
item={item} i={i}
|
||||||
value={dot.val}
|
value={dot.val}
|
||||||
x={dot.x}
|
x={x}
|
||||||
y={dot.y}
|
y={y}
|
||||||
onMouseOver={this.handleFocusIn.bind(this, i)} />
|
onMouseOver={this.handleFocusIn.bind(this, i)} />
|
||||||
);
|
);
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
@ -254,7 +267,9 @@ var StackedAreaChart = React.createClass({
|
||||||
<li key={'legend-'+ item}
|
<li key={'legend-'+ item}
|
||||||
className={'label label-'+ i}
|
className={'label label-'+ i}
|
||||||
onMouseOver={this.handleFocusIn.bind(this, i)}
|
onMouseOver={this.handleFocusIn.bind(this, i)}
|
||||||
onMouseOut={this.handleFocusOut.bind(this, i)}>
|
onMouseOut={this.handleFocusOut.bind(this, i)}
|
||||||
|
onClick={this.handleClick.bind(this, item)}
|
||||||
|
>
|
||||||
<div className="color-dot" style={{backgroundColor: Colors[i]}}></div>
|
<div className="color-dot" style={{backgroundColor: Colors[i]}}></div>
|
||||||
{item}
|
{item}
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
.sachart-container .legend li {
|
.sachart-container .legend li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 10px 15px 0 0;
|
padding: 10px 15px 0 0;
|
||||||
cursor: default;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sachart-container.focused .path {
|
.sachart-container.focused .path {
|
||||||
|
|
Loading…
Reference in New Issue