Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Christopher Valles 2014-03-03 17:33:40 +00:00
commit bee20a5478

View File

@ -210,29 +210,32 @@
scope.chart.series[0].remove(false);
};
if (_.some(scope.series[0].data, function (p) {
return angular.isString(p.x)
return (angular.isString(p.x) || angular.isDefined(p.name));
})) {
scope.chart.xAxis[0].update({type: 'category'});
// We need to make sure that for each category, each series has a value.
var categories = _.union.apply(this, _.map(scope.series, function (s) {
return _.pluck(s.data, 'x')
}));
if (!angular.isDefined(scope.series[0].data[0].name)) {
// We need to make sure that for each category, each series has a value.
var categories = _.union.apply(this, _.map(scope.series, function (s) {
return _.pluck(s.data, 'x')
}));
_.each(scope.series, function (s) {
// TODO: move this logic to Query#getChartData
var yValues = _.groupBy(s.data, 'x');
_.each(scope.series, function (s) {
// TODO: move this logic to Query#getChartData
var yValues = _.groupBy(s.data, 'x');
var newData = _.sortBy(_.map(categories, function (category) {
return {
name: category,
y: yValues[category] && yValues[category][0].y
}
}), 'name');
var newData = _.sortBy(_.map(categories, function (category) {
return {
name: category,
y: yValues[category] && yValues[category][0].y
}
}), 'y').reverse();
s.data = newData;
});
s.data = newData;
});
}
} else {
scope.chart.xAxis[0].update({type: 'datetime'});
}