root / trunk / web / dojo / dojox / charting / plot3d / Bars.js @ 11
History | View | Annotate | Download (1.5 KB)
1 |
/*
|
---|---|
2 |
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
3 |
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
4 |
see: http://dojotoolkit.org/license for details
|
5 |
*/
|
6 |
|
7 |
|
8 |
if(!dojo._hasResource["dojox.charting.plot3d.Bars"]){ |
9 |
dojo._hasResource["dojox.charting.plot3d.Bars"]=true; |
10 |
dojo.provide("dojox.charting.plot3d.Bars");
|
11 |
dojo.require("dojox.charting.plot3d.Base");
|
12 |
(function(){
|
13 |
var _1=function(a,f,o){ |
14 |
a=typeof a=="string"?a.split(""):a; |
15 |
o=o||dojo.global; |
16 |
var z=a[0]; |
17 |
for(var i=1;i<a.length;z=f.call(o,z,a[i++])){ |
18 |
} |
19 |
return z;
|
20 |
}; |
21 |
dojo.declare("dojox.charting.plot3d.Bars",dojox.charting.plot3d.Base,{constructor:function(_2,_3,_4){ |
22 |
this.depth="auto"; |
23 |
this.gap=0; |
24 |
this.data=[];
|
25 |
this.material={type:"plastic",finish:"dull",color:"lime"}; |
26 |
if(_4){
|
27 |
if("depth" in _4){ |
28 |
this.depth=_4.depth;
|
29 |
} |
30 |
if("gap" in _4){ |
31 |
this.gap=_4.gap;
|
32 |
} |
33 |
if("material" in _4){ |
34 |
var m=_4.material;
|
35 |
if(typeof m=="string"||m instanceof dojo.Color){ |
36 |
this.material.color=m;
|
37 |
}else{
|
38 |
this.material=m;
|
39 |
} |
40 |
} |
41 |
} |
42 |
},getDepth:function(){ |
43 |
if(this.depth=="auto"){ |
44 |
var w=this.width; |
45 |
if(this.data&&this.data.length){ |
46 |
w=w/this.data.length;
|
47 |
} |
48 |
return w-2*this.gap; |
49 |
} |
50 |
return this.depth; |
51 |
},generate:function(_5,_6){ |
52 |
if(!this.data){ |
53 |
return this; |
54 |
} |
55 |
var _7=this.width/this.data.length,_8=0,_9=this.depth=="auto"?_7-2*this.gap:this.depth,_a=this.height/_1(this.data,Math.max); |
56 |
if(!_6){
|
57 |
_6=_5.view; |
58 |
} |
59 |
for(var i=0;i<this.data.length;++i,_8+=_7){ |
60 |
_6.createCube({bottom:{x:_8+this.gap,y:0,z:0},top:{x:_8+_7-this.gap,y:this.data[i]*_a,z:_9}}).setFill(this.material); |
61 |
} |
62 |
}}); |
63 |
})(); |
64 |
} |