summaryrefslogtreecommitdiff
path: root/addons/base_graph/static/src
diff options
context:
space:
mode:
authorKunal Chavda (OpenERP) <kch@tinyerp.com>2011-04-11 16:09:25 +0530
committerKunal Chavda (OpenERP) <kch@tinyerp.com>2011-04-11 16:09:25 +0530
commit57ea8384a72a52b3fed072b891c8b9437888dd43 (patch)
tree9b5c0f8f4d28017996f93bd27623b73b0c3495e6 /addons/base_graph/static/src
parentec660c8bf9eae97d26115e80950694dbe36fa6b3 (diff)
[IMP]Initially show stackedbar chart with static data.
bzr revid: kch@tinyerp.com-20110411103925-6o0bgwp71njh33bs
Diffstat (limited to 'addons/base_graph/static/src')
-rw-r--r--addons/base_graph/static/src/graph.js118
1 files changed, 101 insertions, 17 deletions
diff --git a/addons/base_graph/static/src/graph.js b/addons/base_graph/static/src/graph.js
index 30315b37aa8..d7d8b1c7ac9 100644
--- a/addons/base_graph/static/src/graph.js
+++ b/addons/base_graph/static/src/graph.js
@@ -49,23 +49,107 @@ openerp.base.GraphView = openerp.base.Controller.extend({
this.$element.html(QWeb.render("GraphView", {"view": this, "fields_view": this.fields_view}));
},
create_graph: function(res) {
- 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");
- }
+ //if (this.graph_type == "bar"){
+ var barChart = new dhtmlXChart({
+ view:"bar",
+ container:"barchart",
+ value:"#"+this.fields['total']+"#",
+ color:"#9abe00",
+ width:40,
+ tooltip: "#"+this.fields['id']+"#",
+ xAxis:{
+ template:"#"+this.fields['id']+"#"
+ },
+ yAxis:{
+ title: "Total"
+ }
+ });
+ barChart.parse(res, "json");
+ //}
+ var pieChart = new dhtmlXChart({
+ view: "pie",
+ container: "piechart",
+ value: "#"+this.fields['total']+"#",
+ label: "#"+this.fields['id']+"#",
+ pieInnerText: "<b>#"+this.fields['total']+"#</b>",
+ gradient: true,
+ radius: 90,
+ x: 280,
+ y: 150
+ });
+ pieChart.parse(res, "json");
+
+ /*static data for stackedbar chart*/
+ var data = [{
+ total: "2.0",
+ total1: "0.0",
+ stage: "Lost"
+ }, {
+ total: "1.0",
+ total1: "2.0",
+ stage: "Negotiation"
+ }, {
+ total: "4.0",
+ total1: "2.0",
+ stage: "New"
+ }, {
+ total: "3.0",
+ total1: "0.0",
+ stage: "Proposition"
+ }, {
+ total: "1.0",
+ total1: "1.0",
+ stage: "Qualification"
+ }, {
+ total: "1.0",
+ total1: "0.0",
+ stage: "Won"
+ }];
+
+ var stackedChart = new dhtmlXChart({
+ view: "stackedBar",
+ container: "stackedchart",
+ value: "#total#",
+ label: "#total#",
+ width: 60,
+ tooltip: {
+ template: "#total#"
+ },
+ xAxis: {
+ template: "#stage#"
+ },
+ yAxis: {
+ title: "User"
+ },
+ gradient: "3d",
+ color: "#66cc33",
+ legend: {
+ values: [{
+ text: "Administrator",
+ color: "#66cc33"
+ }, {
+ text: "Demo User",
+ color: "#ff9933"
+ }],
+ valign: "top",
+ align: "right",
+ width: 120,
+ layout: "y",
+ marker: {
+ width: 15,
+ type: "round"
+ }
+ }
+ });
+ stackedChart.addSeries({
+ value: "#total1#",
+ color: "#ff9933",
+ label: "#total1#",
+ tooltip: {
+ template: "#total1#"
+ }
+ });
+ stackedChart.parse(data, "json");
},