summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js/graph.js
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2013-12-11 15:01:40 +0100
committerGery Debongnie <ged@openerp.com>2013-12-11 15:01:40 +0100
commitb04f21ea12406fc28e7a74494af0397f6ce9e6d1 (patch)
tree20f54e38032fe77dbba83dbd5b1ee8d23686a23f /addons/web_graph/static/src/js/graph.js
parentb8a5b2d2b509bd19ef580f6c137327dbbae924f5 (diff)
[IMP] finally uses the full width and height to draw charts, instead of hardcoded numbers (in graph view) (addon web_graph)
bzr revid: ged@openerp.com-20131211140140-shlpos1jt3z8wj41
Diffstat (limited to 'addons/web_graph/static/src/js/graph.js')
-rw-r--r--addons/web_graph/static/src/js/graph.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js
index 8070bb152ce..f1d08968626 100644
--- a/addons/web_graph/static/src/js/graph.js
+++ b/addons/web_graph/static/src/js/graph.js
@@ -61,6 +61,8 @@ instance.web_graph.GraphView = instance.web.View.extend({
start: function () {
this.table = $('<table></table>');
this.$('.graph_main_content').append(this.table);
+ this.width = this.$el.width();
+ this.height = this.$el.parent().parent().height(); // to get view manager body
instance.web.bus.on('click', this, function (ev) {
if (this.dropdown) {
this.dropdown.remove();
@@ -178,8 +180,15 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.draw_table();
} else {
this.$('.graph_main_content').append($('<div><svg></svg></div>'));
- var svg = this.$('.graph_main_content svg')[0];
- openerp.web_graph.draw_chart(this.mode, this.pivot_table, svg, this.measure_label());
+ var options = {
+ svg: this.$('.graph_main_content svg')[0],
+ mode: this.mode,
+ pivot: this.pivot_table,
+ width: this.width,
+ height: this.height - 30,
+ measure_label: this.measure_label()
+ };
+ openerp.web_graph.draw_chart(options);
}
}
}