diff --git a/rd_ui/app/scripts/ng-highchart.js b/rd_ui/app/scripts/ng-highchart.js index f7d06418c..6a7c31acc 100644 --- a/rd_ui/app/scripts/ng-highchart.js +++ b/rd_ui/app/scripts/ng-highchart.js @@ -215,24 +215,26 @@ })) { 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'}); }