[IMP]Initially show stackedbar chart with static data.

bzr revid: kch@tinyerp.com-20110411103925-6o0bgwp71njh33bs
This commit is contained in:
Kunal Chavda (OpenERP)
2011-04-11 16:09:25 +05:30
parent ec660c8bf9
commit 57ea8384a7
2 changed files with 106 additions and 18 deletions
+5 -1
View File
@@ -210,7 +210,11 @@
<t t-name="GraphView">
<table>
<tr>
<td><div id="chart1" style="width:900px;height:500px;border:1px solid #A4BED4;"></div></td>
<td><div id="barchart" style="width:900px;height:500px;border:1px solid #A4BED4;"></div></td>
<td>
<div id="piechart" style="width:600px;height:250px;border:1px solid #A4BED4;"></div>
<div id="stackedchart" style="width:600px;height:250px;border:1px solid #A4BED4;"></div>
</td>
</tr>
</table>
</t>
+101 -17
View File
@@ -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");
},