diff --git a/source/Ox.UI/js/List/Chart.js b/source/Ox.UI/js/List/Chart.js index f5b018bf..053e6a13 100644 --- a/source/Ox.UI/js/List/Chart.js +++ b/source/Ox.UI/js/List/Chart.js @@ -8,6 +8,7 @@ Ox.Chart Bar Chart formatKey Format function for keys keyAlign Alignment of keys keyWidth Width of keys + limit Number of items, or 0 for all rows undocumented sort Sort title Chart title @@ -26,6 +27,7 @@ Ox.Chart = function(options, self) { formatKey: null, keyAlign: 'right', keyWidth: 128, + limit: 0, rows: 1, sort: {key: 'value', operator: '-'}, sortKey: null, @@ -39,12 +41,7 @@ Ox.Chart = function(options, self) { renderChart(); } }) - .addClass('OxChart') - .css({ - width: self.options.width + 'px', - height: 16 + Ox.len(self.options.data) * 16 + 'px', - overflowY: 'hidden' - }); + .addClass('OxChart'); self.valueWidth = self.options.width - self.options.keyWidth; @@ -113,6 +110,9 @@ Ox.Chart = function(options, self) { : key == 'value' && self.sort[a.key] > self.sort[b.key] ? 1 : 0; }); + if (self.options.limit) { + self.items = self.items.slice(0, self.options.limit); + } if (self.options.rows == 2) { self.row = 0; @@ -168,6 +168,11 @@ Ox.Chart = function(options, self) { } function renderChart() { + that.css({ + width: self.options.width + 'px', + height: 16 + self.items.length * 16 + 'px', + overflowY: 'hidden' + }); return Ox.TableList({ columns: getColumns(), items: self.items,