[IMP]Improved code for x-axis label rotation upto sixty degree.

bzr revid: kch@tinyerp.com-20110621105031-cqb165ocpgh3og6t
This commit is contained in:
Kunal Chavda (OpenERP) 2011-06-21 16:20:31 +05:30
parent f41b9ccfa0
commit 543460f23a
2 changed files with 7 additions and 1 deletions

View File

@ -120,7 +120,7 @@ f:d.y,10)+0.5;var i=d.x,j,k=true;this.i(a,g,f,i,f,this.e.xAxis.color,1);for(var
0.2)}},Da:function(a,b,c,d,e,f){var g;b={};if(this.e.yAxis){var i=c.x-0.5,j=d.y,k=c.y,h=d.y;this.i(a,i,j,i,k,this.e.yAxis.color,1);if(this.e.yAxis.step)g=parseFloat(this.e.yAxis.step);if(typeof this.e.yAxis.step=="undefined"||typeof this.e.yAxis.start=="undefined"||typeof this.e.yAxis.end=="undefined"){b=this.V(e,f);e=b.start;f=b.end;g=b.step;this.e.yAxis.end=f;this.e.yAxis.start=e}if(g!==0){k=(j-k)*g/(f-e);for(var m=0,l=e;l<=f;l+=g){if(b.fixNum)l=parseFloat((new Number(l)).toFixed(b.fixNum));var n=
Math.floor(j-m*k)+0.5;!(l==e&&this.e.origin=="auto")&&this.e.yAxis.lines&&this.i(a,i,n,d.x,n,this.e.yAxis.color,0.2);if(l==this.e.origin)h=n;this.renderText(0,n-5,this.e.yAxis.template(l.toString()),"dhx_axis_item_y",c.x-5);m++}this.oa(c,d);return h}}},oa:function(a,b){if(a=this.renderTextAt("middle",false,0,parseInt((b.y-a.y)/2+a.y,10),this.e.yAxis.title,"dhx_axis_title_y"))a.style.left=(dhtmlx.env.transform?(a.offsetHeight-a.offsetWidth)/2:0)+"px"},V:function(a,b){if(this.e.origin!="auto"&&this.e.origin<
a)a=this.e.origin;var c,d,e;c=(b-a)/8||1;var f=Math.floor(this.ga(c)),g=Math.pow(10,f),i=c/g;i=i>5?10:5;c=parseInt(i,10)*g;if(c>Math.abs(a))d=a<0?-c:0;else{var j=Math.abs(a),k=Math.floor(this.ga(j)),h=j/Math.pow(10,k);d=Math.ceil(h*10)/10*Math.pow(10,k)-c;if(a<0)d=-d-2*c}for(e=d;e<b;){e+=c;e=parseFloat((new Number(e)).toFixed(Math.abs(f)))}return{start:d,end:e,step:c,fixNum:Math.abs(f)}},O:function(a){var b,c;if((c=arguments.length&&a=="h"?this.e.xAxis:this.e.yAxis)&&typeof c.end!="undefied"&&typeof c.start!=
"undefied"&&c.step){b=parseFloat(c.end);c=parseFloat(c.start)}else{b=this.max(this.h[0].value);c=this.min(this.h[0].value);if(this.h.length>1)for(var d=1;d<this.h.length;d++){var e=this.max(this.h[d].value),f=this.min(this.h[d].value);if(e>b)b=e;if(f<c)c=f}}return{max:b,min:c}},ga:function(a){var b="log";return Math.floor(Math[b](a)/Math.LN10)},Ba:function(a,b,c,d,e){this.e.xAxis&&this.renderTextAt(e,d,a,b,this.e.xAxis.template(c))},Ca:function(a,b,c,d){this.e.xAxis&&this.e.xAxis.lines&&this.i(a,
"undefied"&&c.step){b=parseFloat(c.end);c=parseFloat(c.start)}else{b=this.max(this.h[0].value);c=this.min(this.h[0].value);if(this.h.length>1)for(var d=1;d<this.h.length;d++){var e=this.max(this.h[d].value),f=this.min(this.h[d].value);if(e>b)b=e;if(f<c)c=f}}return{max:b,min:c}},ga:function(a){var b="log";return Math.floor(Math[b](a)/Math.LN10)},Ba:function(a,b,c,d,e){this.e.xAxis&&this.renderTextAt(e,d,a,b,this.e.xAxis.template(c), "dhx_axis_item_x")},Ca:function(a,b,c,d){this.e.xAxis&&this.e.xAxis.lines&&this.i(a,
b,c,b,d,this.e.xAxis.color,0.2)},i:function(a,b,c,d,e,f,g){a.strokeStyle=f;a.lineWidth=g;a.beginPath();a.moveTo(b,c);a.lineTo(d,e);a.stroke()},z:function(a,b){var c=1;if(b!=a){a=b-a;if(Math.abs(a)<1)for(;Math.abs(a)<1;){c*=10;a*=c}}else a=a;return[a,c]},Za:[function(a){return"#FF"+dhtmlx.math.toHex(a/2,2)+"00"},function(a){return"#FF"+dhtmlx.math.toHex(a/2+128,2)+"00"},function(a){return"#"+dhtmlx.math.toHex(255-a,2)+"FF00"},function(a){return"#00FF"+dhtmlx.math.toHex(a,2)},function(a){return"#00"+
dhtmlx.math.toHex(255-a,2)+"FF"},function(a){return"#"+dhtmlx.math.toHex(a,2)+"00FF"}],addSeries:function(a){var b=this.e;this.e=dhtmlx.extend({},b);this.B(a,{});this.h.push(this.e);this.e=b},db:function(a,b){this.ra=b.getAttribute("userdata");for(a=0;a<this.h.length;a++){var c=this.h[a].tooltip;c&&c.disable()}(c=this.h[this.ra].tooltip)&&c.enable()},za:function(a,b){var c=0,d=0,e=this.e.legend,f,g,i=this.e.legend.layout!="x"?"width:"+e.width+"px":"",j=dhtmlx.html.create("DIV",{"class":"dhx_chart_legend",
style:"left:"+c+"px; top:"+d+"px;"+i},"");this.g.appendChild(j);var k=[];if(e.values)for(h=0;h<e.values.length;h++)k.push(this.aa(j,e.values[h].text));else for(var h=0;h<b.length;h++)k.push(this.aa(j,e.template(b[h])));g=j.offsetWidth;f=j.offsetHeight;this.e.legend.width=g;this.e.legend.height=f;if(g<this.g.offsetWidth){if(e.layout=="x"&&e.align=="center")c=(this.g.offsetWidth-g)/2;if(e.align=="right")c=this.g.offsetWidth-g}if(f<this.g.offsetHeight)if(e.valign=="middle"&&e.align!="center"&&e.layout!=

View File

@ -277,6 +277,9 @@ openerp.base_graph.GraphView = openerp.base.View.extend({
gradient: "3d",
border: false,
width: 1024,
tooltip:{
template:"#"+group_list[0]+"#"
},
radius: 0,
color:grp_color[0]['color'],
origin:0,
@ -326,6 +329,9 @@ openerp.base_graph.GraphView = openerp.base.View.extend({
for (var m = 1; m<group_list.length;m++){
bar_chart.addSeries({
value: "#"+group_list[m]+"#",
tooltip:{
template:"#"+group_list[m]+"#"
},
color: grp_color[m]['color']
});
}