diff options
| author | Gery Debongnie <ged@openerp.com> | 2013-11-28 10:47:46 +0100 |
|---|---|---|
| committer | Gery Debongnie <ged@openerp.com> | 2013-11-28 10:47:46 +0100 |
| commit | 4aa70638ef8418f18e05bd8ff7dba88724b886a6 (patch) | |
| tree | 53817c48a19c33e90574e33392b32ca7a8af3c53 /addons/web_graph/static/src/js/graph.js | |
| parent | d790f8e96f2944ef120383d22696ec4038a56738 (diff) | |
[REF] adds a 'get_total' method and simplify a few parts of the code using totals (addon web_graph)
bzr revid: ged@openerp.com-20131128094746-mthch89zqx66flq7
Diffstat (limited to 'addons/web_graph/static/src/js/graph.js')
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 119d0b12e16..c1c2b52f4b8 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -363,8 +363,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ }); if (pivot.cols.main.children.length > 0) { - var row_total = pivot.get_value(row.id, pivot.cols.main.id), - cell = make_cell(row_total, pivot.cols.main) + var cell = make_cell(pivot.get_total(row), pivot.cols.main) .css('font-weight', 'bold'); html_row.append(cell); } @@ -384,16 +383,17 @@ instance.web_graph.GraphView = instance.web.View.extend({ } cell.append(value); if (self.mode === 'heatmap') { - color = Math.floor(50 + 205*(pivot.total - value)/pivot.total); + total = pivot.get_total(); + color = Math.floor(50 + 205*(total - value)/total); cell.css('background-color', $.Color(255, color, color)); } if (self.mode === 'row_heatmap') { - total = pivot.get_value(row.id, pivot.cols.main.id); + total = pivot.get_total(row); color = Math.floor(50 + 205*(total - value)/total); cell.css('background-color', $.Color(255, color, color)); } if (self.mode === 'col_heatmap') { - total = pivot.get_value(col.id, pivot.rows.main.id); + total = pivot.get_total(col); color = Math.floor(50 + 205*(total - value)/total); cell.css('background-color', $.Color(255, color, color)); } |
