diff options
Diffstat (limited to 'addons/web_graph/static/src')
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index f153a2155f0..124c339457d 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -97,7 +97,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ this.$element.html(QWeb.render("GraphView", { "fields_view": this.fields_view, "chart": this.chart, - 'element_id': this.element_id + 'element_id': this.widget_parent.element_id })); var fields = _(this.columns).pluck('name').concat([this.abscissa]); @@ -183,7 +183,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ var self = this; var group_list, view_chart = (self.chart == 'line')?'line':(self.chart == 'area')?'area':''; - if (!this.group_field) { + if (!this.group_field || !results.length) { if (self.chart == 'bar'){ view_chart = (this.orientation === 'horizontal') ? 'barH' : 'bar'; } @@ -267,7 +267,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ self.renderer = null; var charts = new dhtmlXChart({ view: view_chart, - container: self.element_id+"-"+self.chart+"chart", + container: self.widget_parent.element_id+"-"+self.chart+"chart", value:"#"+group_list[0].group+"#", gradient: (self.chart == "bar") ? "3d" : "light", alpha: (self.chart == "area") ? 0.6 : 1, @@ -304,6 +304,8 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ } } }); + self.$element.find("#"+self.widget_parent.element_id+"-"+self.chart+"chart").width( + self.$element.find("#"+self.widget_parent.element_id+"-"+self.chart+"chart").width()+120); for (var m = 1; m<group_list.length;m++){ var column = group_list[m]; @@ -326,8 +328,8 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ }); } charts.parse(results, "json"); - self.$element.find("#"+self.element_id+"-"+self.chart+"chart").height( - self.$element.find("#"+self.element_id+"-"+self.chart+"chart").height()+50); + self.$element.find("#"+self.widget_parent.element_id+"-"+self.chart+"chart").height( + self.$element.find("#"+self.widget_parent.element_id+"-"+self.chart+"chart").height()+50); charts.attachEvent("onItemClick", function(id) { self.open_list_view(charts.get(id)); }); |
