Skip to content

Commit

Permalink
Merge pull request getredash#130 from EverythingMe/fix_category_chart…
Browse files Browse the repository at this point in the history
…_sorting

Fix: (in category charts) don't sort values when there is more than one category
  • Loading branch information
arikfr committed Mar 11, 2014
2 parents 81525fa + 97b727d commit 7d9a7ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rd_ui/app/scripts/ng-highchart.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,16 @@
// TODO: move this logic to Query#getChartData
var yValues = _.groupBy(s.data, 'x');

var newData = _.sortBy(_.map(categories, function (category) {
var newData = _.map(categories, function (category) {
return {
name: category,
y: yValues[category] && yValues[category][0].y
}
}), 'y').reverse();
});

if (categories.length == 1) {
newData = _.sortBy(newData, 'y').reverse();
};

s.data = newData;
});
Expand Down

0 comments on commit 7d9a7ea

Please sign in to comment.