diff options
| author | Kunal Chavda (OpenERP) <kch@tinyerp.com> | 2011-12-09 16:35:21 +0530 |
|---|---|---|
| committer | Kunal Chavda (OpenERP) <kch@tinyerp.com> | 2011-12-09 16:35:21 +0530 |
| commit | 165f43d2ce63e2c4ad6c513466e7e79173422d55 (patch) | |
| tree | 8eb5614ef563b3360ab8bd916c77a7fe4a09d2fa /addons/web_graph/static/src/js/graph.js | |
| parent | 65483c91a6b8d6aac677ca1a50e734e027146ef8 (diff) | |
[IMP]Improved code for use different properties when different chart type.
bzr revid: kch@tinyerp.com-20111209110521-srj00rg522kjho0f
Diffstat (limited to 'addons/web_graph/static/src/js/graph.js')
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 02bc48375aa..02ff80b3e01 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -273,7 +273,8 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ view: view_chart, container: self.element_id+"-"+self.chart+"chart", value:"#"+group_list[0].group+"#", - gradient: "3d", + gradient: (self.chart == "bar") ? "3d" : "light", + alpha: (self.chart == "area") ? 0.6 : 1, border: false, width: 1024, tooltip:{ @@ -281,7 +282,15 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ self.abscissa, group_list[0].text, group_list[0].group) }, radius: 0, - color:group_list[0].color, + color: (self.chart != "line") ? group_list[0].color : "", + item: (self.chart == "line") ? { + borderColor: group_list[0].color, + color: "#000000" + } : "", + line: (self.chart == "line") ? { + color: group_list[0].color, + width: 3 + } : "", origin:0, xAxis: x_axis, yAxis: y_axis, @@ -299,16 +308,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ } } }); - if (self.chart == 'line'){ - charts.define("item",{ - borderColor: group_list[0].color, - color: "#000000" - }); - charts.define("line",{ - color: group_list[0].color, - width: 3 - }); - } + for (var m = 1; m<group_list.length;m++){ var column = group_list[m]; if (column.group === self.group_field) { continue; } @@ -318,18 +318,16 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ template: _.str.sprintf("#%s#, %s=#%s#", self.abscissa, column.text, column.group) }, - color: column.color + color: (self.chart != "line") ? column.color : "", + item: (self.chart == "line") ? { + borderColor: column.color, + color: "#000000" + } : "", + line: (self.chart == "line") ? { + color: column.color, + width: 3 + } : "" }); - if (self.chart == 'line'){ - charts.define("item",{ - borderColor: column.color, - color: "#000000" - }); - charts.define("line",{ - color: column.color, - width: 3 - }); - } } charts.parse(results, "json"); self.$element.find("#"+self.element_id+"-"+self.chart+"chart").height( |
