[IMP]Initialy show bar chart with data.

bzr revid: kch@tinyerp.com-20110408085005-hv9jv2wcfopnxrgm
This commit is contained in:
Kunal Chavda (OpenERP)
2011-04-08 14:20:05 +05:30
parent 8f9edb9a10
commit 20c75c45d8
60 changed files with 403 additions and 392 deletions
+3 -3
View File
@@ -26,8 +26,8 @@
<script type="text/javascript" src="/base_gantt/static/lib/dhtmlxGantt/codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" src="/base_gantt/static/lib/dhtmlxGantt/codebase/dhtmlxgantt.js"></script>
<script type="text/javascript" src="/base_gantt/static/src/gantt.js"></script>
<script type="text/javascript" src="/base_graph/static/openerp/js/graph.js"></script>
<script type="text/javascript" src="/base_graph/static/dhtmlxChart/codebase/dhtmlxchart.js"></script>
<script type="text/javascript" src="/base_graph/static/lib/dhtmlxGraph/codebase/dhtmlxchart.js"></script>
<script type="text/javascript" src="/base_graph/static/src/graph.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="/base_gantt/static/lib/dhtmlxGantt/codebase/dhtmlxgantt.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/base/static/lib/jquery.ui/css/smoothness/jquery-ui-1.8.9.custom.css" />
@@ -35,7 +35,7 @@
<link rel="stylesheet" type="text/css" media="screen" href="/base/static/lib/jquery.jqGrid/css/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" href="/base/static/lib/jquery.superfish/css/superfish.css" media="screen">
<link rel="stylesheet" href="/base/static/src/css/base.css" type="text/css"/>
<link rel="stylesheet" type="text/css" media="screen" href="/base_graph/static/dhtmlxChart/codebase/dhtmlxchart.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/base_graph/static/lib/dhtmlxGraph/codebase/dhtmlxchart.css"/>
<script type="text/javascript">
$(function() {
+6 -2
View File
@@ -52,7 +52,7 @@
</t>
<t t-name="Login">
<form>
Database: <input type="text" name="db" value="trunk"/><br/>
Database: <input type="text" name="db" value="db_trunk"/><br/>
Login: <input type="text" name="login" value="admin"/><br/>
Password: <input type="password" name="password" value="a"/><br/>
<input type="submit" name="submit" value="Login"/>
@@ -208,7 +208,11 @@
<t t-raw="frame.render()"/>
</t>
<t t-name="GraphView">
<div id="chart1" style="width:450px;height:300px;border:1px solid #A4BED4;float:left;margin-right:20px"></div>
<table>
<tr>
<td><div id="chart1" style="width:800px;height:500px;border:1px solid #A4BED4;"></div></td>
</tr>
</table>
</t>
<t t-name="Widget">
Unhandled widget
+1 -5
View File
@@ -60,10 +60,6 @@ class GraphView(openerpweb.Controller):
def create_event(self, event_ids, model):
self.events = model.read(event_ids, self.fields.values())
# print "\n self.fields.values()++",self.fields.values()
# print "\n self.events++++++++++++++++++++",self.events
# result = [{'partner_id': 'China Export', 'amount_total': 3000.0}]
return {'result': result}
return {'result': self.events}
@@ -1,5 +1,5 @@
/*---------------------------------------------------------
* OpenERP base_gantt
* OpenERP base_graph
*---------------------------------------------------------*/
openerp.base.graph = function (openerp) {
@@ -38,7 +38,6 @@ openerp.base.GraphView = openerp.base.Controller.extend({
this.fields['partner_id'] = this.fields_view.arch.children[0].attrs.name;
this.fields['total'] = this.fields_view.arch.children[1].attrs.name;
console.log("this.fields",this.fields_view);
this.rpc('/base_graph/graphview/get_events',
{'model': this.model,
'fields': this.fields
@@ -49,19 +48,30 @@ openerp.base.GraphView = openerp.base.Controller.extend({
this.$element.html(QWeb.render("GraphView", {"view": this, "fields_view": this.fields_view}));
},
create_graph: function(res) {
window.onload = function() {
var barChart1 = new dhtmlXChart({
view: "bar",
container: "chart1",
value: '#partner_id#',
label: '#amount_total#',
width: 30,
gradient: true,
});
barChart1.parse(res, "json");
}
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");
},
});
// here you may tweak globals object, if any, and play with on_* or do_* callbacks on them