summaryrefslogtreecommitdiff
path: root/addons/base_graph/static
diff options
context:
space:
mode:
authorKunal Chavda (OpenERP) <kch@tinyerp.com>2011-04-08 18:58:24 +0530
committerKunal Chavda (OpenERP) <kch@tinyerp.com>2011-04-08 18:58:24 +0530
commit6cd59e4cfdb8aba6d5a9e1cb7cc3dc799382a740 (patch)
treedd52fa8e38a950bab562ce0478c2cfea5758bbaa /addons/base_graph/static
parent20c75c45d8888e44b9b58b8ba67c6b5b2e8e7876 (diff)
[IMP]Improvement in show bar chart with data.
bzr revid: kch@tinyerp.com-20110408132824-vi85a34pg4in9ndw
Diffstat (limited to 'addons/base_graph/static')
-rw-r--r--addons/base_graph/static/src/graph.js41
1 files changed, 19 insertions, 22 deletions
diff --git a/addons/base_graph/static/src/graph.js b/addons/base_graph/static/src/graph.js
index 4e6cfbf2e2c..30315b37aa8 100644
--- a/addons/base_graph/static/src/graph.js
+++ b/addons/base_graph/static/src/graph.js
@@ -35,8 +35,9 @@ openerp.base.GraphView = openerp.base.Controller.extend({
var self = this;
this.name = this.fields_view.name || this.fields_view.arch.attrs.string;
this.view_id = this.fields_view.view_id;
- this.fields['partner_id'] = this.fields_view.arch.children[0].attrs.name;
+ this.fields['id'] = this.fields_view.arch.children[0].attrs.name;
this.fields['total'] = this.fields_view.arch.children[1].attrs.name;
+ this.graph_type = this.fields_view.arch.attrs.type;
this.rpc('/base_graph/graphview/get_events',
{'model': this.model,
@@ -48,27 +49,23 @@ openerp.base.GraphView = openerp.base.Controller.extend({
this.$element.html(QWeb.render("GraphView", {"view": this, "fields_view": this.fields_view}));
},
create_graph: function(res) {
- var result = res.result;
-
- var barChart1 = new dhtmlXChart({
- view:"bar",
- container:"chart1",
- value:"#amount_total#",
- color:"#9abe00",
- width:50,
- tooltip: "#partner_id#",
- xAxis:{
- title:"Partner",
- template:"#partner_id#"
- },
- yAxis:{
- start:0,
- end:10000,
- step:1000,
- title:"Total"
- }
- });
- barChart1.parse(result, "json");
+ if (this.graph_type == "bar"){
+ var barChart1 = new dhtmlXChart({
+ view:"bar",
+ container:"chart1",
+ value:"#"+this.fields['total']+"#",
+ color:"#9abe00",
+ width:40,
+ tooltip: "#"+this.fields['id']+"#",
+ xAxis:{
+ template:"#"+this.fields['id']+"#"
+ },
+ yAxis:{
+ title: "Total"
+ }
+ });
+ barChart1.parse(res, "json");
+ }
},