diff --git a/source/Ox.UI/js/List/Chart.js b/source/Ox.UI/js/List/Chart.js index 84a565f6..be1f6717 100644 --- a/source/Ox.UI/js/List/Chart.js +++ b/source/Ox.UI/js/List/Chart.js @@ -92,16 +92,18 @@ Ox.Chart = function(options, self) { } self.items = self.keys.map(function(key) { - var sort = self.sort[key], - value = self.options.data[key]; + var value = self.options.data[key], + sort = self.options.sort.operator == '+' + ? (self.subData ? self.totals[key] : value) + ? (self.subData ? self.max - self.totals[key] : self.max - value); if (self.options.sort.key == 'value') { - sort = Ox.pad(self.subData ? self.totals[key] : value, 64) + sort; + sort = Ox.pad(value, 64) + sort; } return {key: key, value: value, sort: sort}; }); if (self.options.limit) { self.items = Ox.sortBy( - self.items, {key: 'sort', operator: self.options.sort.operator} + self.items, {key: 'sort', operator: '+'} ).slice(0, self.options.limit); self.max = Ox.max(self.items.map(function(item) { return self.subData ? Ox.sum(item.value) : item.value; @@ -174,7 +176,7 @@ Ox.Chart = function(options, self) { max: 0, min: 0, pageLength: self.items.length, - sort: [{key: 'sort', operator: self.options.sort.operator}], + sort: [{key: 'sort', operator: '+'}], width: self.options.width, unique: 'key' })