diff --git a/addons/base_graph/controllers/main.py b/addons/base_graph/controllers/main.py index 516bdb85189..680b9e030c2 100644 --- a/addons/base_graph/controllers/main.py +++ b/addons/base_graph/controllers/main.py @@ -7,4 +7,5 @@ class GraphView(View): @openerpweb.jsonrequest def load(self, req, model, view_id): fields_view = self.fields_view_get(req, model, view_id, 'graph') - return {'fields_view': fields_view} \ No newline at end of file + all_fields = req.session.model(model).fields_get() + return {'fields_view': fields_view, 'all_fields':all_fields} \ No newline at end of file diff --git a/addons/base_graph/static/src/js/graph.js b/addons/base_graph/static/src/js/graph.js index 869b26ac291..8f457c2a8d1 100644 --- a/addons/base_graph/static/src/js/graph.js +++ b/addons/base_graph/static/src/js/graph.js @@ -27,6 +27,7 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({ }, on_loaded: function(data) { var self = this; + this.all_fields = data.all_fields; this.fields_view = data.fields_view; this.name = this.fields_view.name || this.fields_view.arch.attrs.string; this.view_id = this.fields_view.view_id; @@ -52,12 +53,16 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({ this.operator_field = this.chart_info_fields[1]; } this.chart_info = this.chart_info_fields[0]; + this.x_title = this.fields[this.chart_info_fields[0]]['string']; + this.y_title = this.fields[this.operator_field]['string']; this.load_chart(); }, load_chart: function(result) { var self = this; if(result){ + this.x_title = this.all_fields[this.chart_info_fields[0]]['string']; + this.y_title = this.all_fields[this.operator_field]['string']; self.schedule_chart(result); }else{ this.dataset.read_ids( @@ -191,7 +196,9 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({ var oth_ax = {}; temp_ax['template'] = "#name#"; + temp_ax['title'] = ""+self.x_title+"" ; oth_ax['lines'] = true; + oth_ax['title'] = ""+self.y_title+""; if (self.orientation == 'horizontal'){ var x_ax = oth_ax; @@ -212,10 +219,14 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({ origin:0, xAxis: x_ax, yAxis: y_ax, + padding: { + left: 75 + }, legend: { values: grp_color, - align:"right", + align:"left", valign:"top", + layout: "x", marker:{ type:"round", width:12 @@ -246,10 +257,12 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({ }, gradient:"3d", height: 20, + radius: 200, legend: { width: 300, - align:"right", + align:"left", valign:"top", + layout: "x", marker:{ type:"round", width:12 diff --git a/addons/base_graph/static/src/xml/base_graph.xml b/addons/base_graph/static/src/xml/base_graph.xml index 319dc78adae..f8e18fabeea 100644 --- a/addons/base_graph/static/src/xml/base_graph.xml +++ b/addons/base_graph/static/src/xml/base_graph.xml @@ -1,12 +1,6 @@ \ No newline at end of file