[FIX]fixed code for dashboard overriding graph and x-axis label.

bzr revid: kch@tinyerp.com-20110613052846-zxzetxg6dk06qzw1
This commit is contained in:
Kunal Chavda (OpenERP) 2011-06-13 10:58:46 +05:30
parent a4e00cabc0
commit 8521bf46a3
4 changed files with 148 additions and 2714 deletions

View File

@ -3,4 +3,13 @@ Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
.dhx_tooltip{display:none;position:absolute;font-family:Tahoma;font-size:8pt;z-index:10000;background-color:white;padding:2px 2px 2px 2px;border:1px solid #A4BED4;}.dhx_chart{position:relative;font-family:Verdana;font-size:13px;color:#000;overflow:hidden;}.dhx_canvas_text{position:absolute;text-align:center;overflow:hidden;white-space:nowrap;}.dhx_map_img{width:100%;height:100%;position:absolute;top:0;left:0;border:0;filter:alpha(opacity=0);}.dhx_axis_item_y{position:absolute;height:10px;line-height:10px;text-align:right;}.dhx_axis_title_x{text-align:center;}.dhx_axis_title_y{text-align:center;font-family:Verdana;-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-o-transform:rotate(-90deg);padding-left:3px;}.dhx_chart_legend{position:absolute;}.dhx_chart_legend_item{height:18px;line-height:18px;padding:2px;}
.dhx_tooltip{display:none;position:absolute;font-family:Tahoma;font-size:8pt;z-index:10000;background-color:white;padding:2px 2px 2px 2px;border:1px solid #A4BED4;}
.dhx_chart{position:relative;font-family:Verdana;font-size:13px;color:#000;overflow:hidden;}
.dhx_canvas_text{position:absolute;text-align:center;overflow:hidden;white-space:nowrap;}
.dhx_map_img{width:100%;height:100%;position:absolute;top:0;left:0;border:0;filter:alpha(opacity=0);}
.dhx_axis_item_y{position:absolute;height:10px;line-height:10px;text-align:right;}
.dhx_axis_title_y{text-align:center;font-family:Verdana;-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-o-transform:rotate(-90deg);padding-left:3px;}
.dhx_axis_item_x{text-align:center;font-size:8pt;-webkit-transform:rotate(-60deg);-moz-transform:rotate(-60deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-o-transform:rotate(-60deg);padding-left:3px;}
.dhx_axis_title_x{text-align:center;}
.dhx_chart_legend{position:absolute;}
.dhx_chart_legend_item{height:18px;line-height:18px;padding:2px;}

View File

@ -81,9 +81,8 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
},
schedule_chart: function(result) {
this.$element.html(QWeb.render("GraphView", {"fields_view": this.fields_view, "chart": this.chart}));
this.$element.html(QWeb.render("GraphView", {"fields_view": this.fields_view, "chart": this.chart,'view_id': this.view_id}));
this.opration_fld = {};
if (result.length){
for(res in result) {
for(fld in result[res]) {
@ -128,6 +127,7 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
for (i in this.opration_fld){
result.push(this.opration_fld[i]);
}
if(this.chart == 'bar') {
return this.schedule_bar(result);
} else if(this.chart == "pie") {
@ -150,18 +150,19 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
'#75507b', '#3465a4', '#73d216', '#c17d11', '#edd400', '#fcaf3e', '#ef2929', '#ff00c9',
'#ad7fa8', '#729fcf', '#8ae234', '#e9b96e', '#fce94f', '#f57900', '#cc0000', '#d400a8'];
if(self.group_field){
if(self.group_field && (this.operator.length <= 1)){
view_chart = self.orientation == 'horizontal'? 'stackedBarH' : 'stackedBar';
}else{
view_chart = self.orientation == 'horizontal'? 'barH' : 'bar';
}
for (i in result){
if (self.group_field){
if (self.group_field && (this.operator.length <= 1)){
newkey =result[i][self.group_field].split(' ').join('_');
}else{
newkey = "val";
}
if (jQuery.inArray(newkey, self.group_list) == -1){
self.group_list.push(newkey);
if(this.operator.length > 1){
@ -173,7 +174,7 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
for (i in result){
var xystring = result[i][self.chart_info_fields];
if (self.group_field){
if (self.group_field && (self.operator.length <= 1)){
newkey =result[i][self.group_field].split(' ').join('_');
}else{
newkey = "val";
@ -200,7 +201,6 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
xystr[xystring] = xyname;
}
}
for (i in xystr){
res.push(xystr[i]);
}
@ -238,7 +238,7 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
var bar_chart = new dhtmlxchartChart({
view: view_chart,
container: "barchart",
container: self.view_id+"-barchart",
value:"#"+self.group_list[0]+"#",
gradient: "3d",
border: false,
@ -295,14 +295,14 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
bar_chart.parse(res,"json");
bar_chart.attachEvent("onItemClick", function(id) {
var id = bar_chart.get(id);
self.open(id);
self.open_list_view(id);
});
},
schedule_pie: function(result) {
var self = this;
var chart = new dhtmlxchartChart({
view:"pie3D",
container:"piechart",
container:self.view_id+"-piechart",
value:"#"+self.operator_field+"#",
pieInnerText:function(obj) {
var sum = chart.sum("#"+self.operator_field+"#");
@ -331,10 +331,10 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
chart.parse(result,"json");
chart.attachEvent("onItemClick", function(id) {
var id = chart.get(id);
self.open(id);
self.open_list_view(id);
});
},
open : function (id){
open_list_view : function (id){
var self = this;
var id = id[self.chart_info_fields];
if (typeof id == 'object'){

View File

@ -1,6 +1,6 @@
<template>
<t t-name="GraphView">
<h2 class="oe_view_title"><t t-esc="fields_view.arch.attrs.string"/></h2>
<div t-att-id="chart+'chart'" style="height:300px;position:relative;border:1px solid #A4BED4;"></div>
<div t-att-id="view_id+'-'+chart+'chart'" style="height:300px;position:relative;border:1px solid #A4BED4;"></div>
</t>
</template>