root / trunk / web / dojo / dojox / charting / plot2d / ClusteredColumns.js @ 10
History | View | Annotate | Download (2.38 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.plot2d.ClusteredColumns"]){ |
9 |
dojo._hasResource["dojox.charting.plot2d.ClusteredColumns"]=true; |
10 |
dojo.provide("dojox.charting.plot2d.ClusteredColumns");
|
11 |
dojo.require("dojox.charting.plot2d.common");
|
12 |
dojo.require("dojox.charting.plot2d.Columns");
|
13 |
dojo.require("dojox.lang.functional");
|
14 |
dojo.require("dojox.lang.functional.reversed");
|
15 |
(function(){
|
16 |
var df=dojox.lang.functional,dc=dojox.charting.plot2d.common,_1=df.lambda("item.purgeGroup()"); |
17 |
dojo.declare("dojox.charting.plot2d.ClusteredColumns",dojox.charting.plot2d.Columns,{render:function(_2,_3){ |
18 |
if(this.zoom&&!this.isDataDirty()){ |
19 |
return this.performZoom(_2,_3); |
20 |
} |
21 |
this.resetEvents();
|
22 |
this.dirty=this.isDirty(); |
23 |
if(this.dirty){ |
24 |
dojo.forEach(this.series,_1);
|
25 |
this._eventSeries={};
|
26 |
this.cleanGroup();
|
27 |
var s=this.group; |
28 |
df.forEachRev(this.series,function(_4){ |
29 |
_4.cleanGroup(s); |
30 |
}); |
31 |
} |
32 |
var t=this.chart.theme,f,_5,_6,_7,ht=this._hScaler.scaler.getTransformerFromModel(this._hScaler),vt=this._vScaler.scaler.getTransformerFromModel(this._vScaler),_8=Math.max(0,this._vScaler.bounds.lower),_9=vt(_8),_a=this.events(); |
33 |
f=dc.calculateBarSize(this._hScaler.bounds.scale,this.opt,this.series.length); |
34 |
_5=f.gap; |
35 |
_6=_7=f.size; |
36 |
for(var i=0;i<this.series.length;++i){ |
37 |
var _b=this.series[i],_c=_7*i; |
38 |
if(!this.dirty&&!_b.dirty){ |
39 |
t.skip(); |
40 |
this._reconnectEvents(_b.name);
|
41 |
continue;
|
42 |
} |
43 |
_b.cleanGroup(); |
44 |
var _d=t.next("column",[this.opt,_b]),s=_b.group,_e=new Array(_b.data.length); |
45 |
for(var j=0;j<_b.data.length;++j){ |
46 |
var _f=_b.data[j];
|
47 |
if(_f!==null){ |
48 |
var v=typeof _f=="number"?_f:_f.y,vv=vt(v),_10=vv-_9,h=Math.abs(_10),_11=typeof _f!="number"?t.addMixin(_d,"column",_f,true):t.post(_d,"column"); |
49 |
if(_6>=1&&h>=1){ |
50 |
var _12={x:_3.l+ht(j+0.5)+_5+_c,y:_2.height-_3.b-(v>_8?vv:_9),width:_6,height:h}; |
51 |
var _13=this._plotFill(_11.series.fill,_2,_3); |
52 |
_13=this._shapeFill(_13,_12);
|
53 |
var _14=s.createRect(_12).setFill(_13).setStroke(_11.series.stroke);
|
54 |
_b.dyn.fill=_14.getFill(); |
55 |
_b.dyn.stroke=_14.getStroke(); |
56 |
if(_a){
|
57 |
var o={element:"column",index:j,run:_b,shape:_14,x:j+0.5,y:v}; |
58 |
this._connectEvents(o);
|
59 |
_e[j]=o; |
60 |
} |
61 |
if(this.animate){ |
62 |
this._animateColumn(_14,_2.height-_3.b-_9,h);
|
63 |
} |
64 |
} |
65 |
} |
66 |
} |
67 |
this._eventSeries[_b.name]=_e;
|
68 |
_b.dirty=false;
|
69 |
} |
70 |
this.dirty=false; |
71 |
return this; |
72 |
}}); |
73 |
})(); |
74 |
} |