root / trunk / web / dojo / dojox / charting / plot3d / Cylinders.js @ 10
History | View | Annotate | Download (1.61 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.Cylinders"]){ |
9 |
dojo._hasResource["dojox.charting.plot3d.Cylinders"]=true; |
10 |
dojo.provide("dojox.charting.plot3d.Cylinders");
|
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.Cylinders",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:"shiny",color:"lime"}; |
26 |
this.outline=null; |
27 |
if(_4){
|
28 |
if("depth" in _4){ |
29 |
this.depth=_4.depth;
|
30 |
} |
31 |
if("gap" in _4){ |
32 |
this.gap=_4.gap;
|
33 |
} |
34 |
if("material" in _4){ |
35 |
var m=_4.material;
|
36 |
if(typeof m=="string"||m instanceof dojo.Color){ |
37 |
this.material.color=m;
|
38 |
}else{
|
39 |
this.material=m;
|
40 |
} |
41 |
} |
42 |
if("outline" in _4){ |
43 |
this.outline=_4.outline;
|
44 |
} |
45 |
} |
46 |
},getDepth:function(){ |
47 |
if(this.depth=="auto"){ |
48 |
var w=this.width; |
49 |
if(this.data&&this.data.length){ |
50 |
w=w/this.data.length;
|
51 |
} |
52 |
return w-2*this.gap; |
53 |
} |
54 |
return this.depth; |
55 |
},generate:function(_5,_6){ |
56 |
if(!this.data){ |
57 |
return this; |
58 |
} |
59 |
var _7=this.width/this.data.length,_8=0,_9=this.height/_1(this.data,Math.max); |
60 |
if(!_6){
|
61 |
_6=_5.view; |
62 |
} |
63 |
for(var i=0;i<this.data.length;++i,_8+=_7){ |
64 |
_6.createCylinder({center:{x:_8+_7/2,y:0,z:0},radius:_7/2-this.gap,height:this.data[i]*_9}).setTransform(dojox.gfx3d.matrix.rotateXg(-90)).setFill(this.material).setStroke(this.outline); |
65 |
} |
66 |
}}); |
67 |
})(); |
68 |
} |