[IMP]Improvement in show bar chart with data.
bzr revid: kch@tinyerp.com-20110408132824-vi85a34pg4in9ndw
This commit is contained in:
parent
20c75c45d8
commit
6cd59e4cfd
|
@ -210,7 +210,7 @@
|
|||
<t t-name="GraphView">
|
||||
<table>
|
||||
<tr>
|
||||
<td><div id="chart1" style="width:800px;height:500px;border:1px solid #A4BED4;"></div></td>
|
||||
<td><div id="chart1" style="width:900px;height:500px;border:1px solid #A4BED4;"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
|
|
|
@ -61,5 +61,10 @@ class GraphView(openerpweb.Controller):
|
|||
def create_event(self, event_ids, model):
|
||||
self.events = model.read(event_ids, self.fields.values())
|
||||
|
||||
return {'result': self.events}
|
||||
result = []
|
||||
for i, evt in enumerate(self.events):
|
||||
self.events[i].pop('id')
|
||||
result.append(evt)
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue